GetTransferCount Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
private void TestGetTransferCount ()
{
   const string UID_IMPLICIT_VR_LITTLE_ENDIAN = "1.2.840.10008.1.2";   // Implicit VR Little Endian
   const string UID_EXPLICIT_VR_BIG_ENDIAN = "1.2.840.10008.1.2.2";   // Explicit VR Big Endian int x = 0;
   string Out = null;
   string result = null;
   //create the Associate Class as Request
   LEADDICOMNet1.CreateAssociate(true);
   //set the Associate to the default
   LEADDICOMNet1.DefaultAssociate(LEADDICOMNet1.hPDU);
   //display each Transfer Syntax for the first Presentation Context
   Out = "";
   for (x = 0; x < LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0)); x++)
   {
      result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), x);
      Out = Out + result;
      Out = Out + "\r";
   }
   MessageBox.Show(Out);
   //add a transfer syntax
   LEADDICOMNet1.AddTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), UID_IMPLICIT_VR_LITTLE_ENDIAN);
   //display each Transfer Syntax for the first Presentation Context
   Out = "";
   for (x = 0; x < LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0)); x++)
   {
      result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), x);
      Out = Out + result;
      Out = Out + "\r";
   }
   MessageBox.Show(Out);
   //change them
   for (x = 0; x < LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0)); x++)
   {
      LEADDICOMNet1.SetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), x, UID_EXPLICIT_VR_BIG_ENDIAN);
   }
   //display each Transfer Syntax for the first Presentation
   Context Out = "";
   for (x = 0; x < LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0)); x++)
   {
      result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), x);
      Out = Out + result;
      Out = Out + "\r";
   }
   MessageBox.Show(Out);
   //delete the last one
   LEADDICOMNet1.DeleteTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0)) - 1);
   //display each Transfer Syntax for the first Presentation Context Out = "";
   for (x = 0; x < LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0)); x++)
   {
      result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, 0), x);
      Out = Out + result;
      Out = Out + "\r";
   }
   MessageBox.Show(Out);
   LEADDICOMNet1.FreeAssociate(LEADDICOMNet1.hPDU);
}