SendNGetRequest Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
//LEADDICOM1 is a DICOM Dataset defined outside this method
//This example uses the predefined variable "gszGetFile" of type "string"
private void TestSendNGetRequest ( )
{
   const string UID_SC_IMAGE_STORAGE = "1.2.840.10008.5.1.4.1.1.7";
   // Secondary Capture Image Storage
   short nRet = 0;
   string szClassUID = null;
   string szInstance = null;
   int hPDU = 0;
   short nID = 0;
   //send an N-GET-REQUEST to the server
   //gszGetFile is a predefined variable used in the NetReceiveNGetResponse event
   gszGetFile = "d:\\temp\\N_GET_REQ.dic" ;
   szClassUID = UID_SC_IMAGE_STORAGE ;
   szInstance = "1.1.1.1" ;
   //here, you must create a list of the identifiers
   //that you wish to get from the server
   LEADDICOMNet1.RequestAttributeCount = 4;
   LEADDICOMNet1.set_RequestAttributes(0, (int)LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_NAME);
   LEADDICOMNet1.set_RequestAttributes(1, (int)LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_ID);
   LEADDICOMNet1.set_RequestAttributes(2, (int)LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_SEX);
   LEADDICOMNet1.set_RequestAttributes(3, (int)LTDICLib.DicomDataSetTagConstants5.TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES);
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet);
   //now, send a request
   nID = LEADDICOMNet1.FindPresentationAbstract(hPDU, szClassUID);
   if (nID == 0)
   {
      nRet = LEADDICOM1.FindUID(szClassUID);
      if (nRet == 0)
         MessageBox.Show("Abstract Syntax, " + LEADDICOM1.get_CurrentUID().Name + ", Not Supported by Association!");
      else
         MessageBox.Show("Abstract Syntax, " + szClassUID + ", Not Supported by Association!");
      return;
   }
   LEADDICOMNet1.SendNGetRequest(LEADDICOMNet1.hNet, nID, 1, szClassUID, szInstance);
}