GetExtendedData Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
private void TestGetExtendedData ( )
{
   int x = 0;
   int n = 0;
   string szOut = null;
   object ExtData = null;
   object Data = null;
   byte[] ttt = new byte[5];
   //create the Associate Class as Request LEADDICOMNet1.CreateAssociate(true);
   //set the Associate to the default
   LEADDICOMNet1.DefaultAssociate(LEADDICOMNet1.hPDU);
   //add some extended data for the first presentation context ttt[0] = 0;
   ttt[1] = 1;
   ttt[2] = 1;
   ttt[3] = 0;
   ttt[4] = 1;
   ExtData = ttt;
   LEADDICOMNet1.SetExtendedData(LEADDICOMNet1.hPDU, 1, ref ExtData, 5);
   //now, display the information
   n = LEADDICOMNet1.GetExtendedDataLength(LEADDICOMNet1.hPDU, 1);
   szOut = "Extended Data" + "\r";
   Data = LEADDICOMNet1.GetExtendedData(LEADDICOMNet1.hPDU, 1);
   for (x = 0; x < n; x++)
   {
      szOut = szOut + System.Convert.ToString(x) + " = ";
      szOut = szOut + System.Convert.ToString(((byte[])Data)[x]) + "\r";
   }
   MessageBox.Show(szOut);
}