IsRoleSelect Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
private void TestIsRoleSelect()
{
   int x = 0;
   int nID = 0;
   string szOut = null;
   short nUser = 0;
   short nProvider = 0;
   //create the Associate Class as Request
   LEADDICOMNet1.CreateAssociate(true);
   //set the Associate to the default
   LEADDICOMNet1.DefaultAssociate(LEADDICOMNet1.hPDU);
   //indicate that we wish to serve as user for each SOP associated
   for (x = 0; x < LEADDICOMNet1.GetPresentationCount(LEADDICOMNet1.hPDU); x++)
   {
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x);
      LEADDICOMNet1.SetRoleSelect(LEADDICOMNet1.hPDU, (short)nID, true, (short)LTDNCLib.PDURoleSelectConstants.PDU_ROLE_SUPPORT, (short)LTDNCLib.PDURoleSelectConstants.PDU_ROLE_NON_SUPPORT);
   }
   //now, display the information
   szOut = "Role Select Info" + "\r";
   for (x = 0; x < LEADDICOMNet1.GetPresentationCount(LEADDICOMNet1.hPDU); x++)
   {
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x);
      szOut = szOut + "ID: " + System.Convert.ToString(nID);
      if (LEADDICOMNet1.IsRoleSelect(LEADDICOMNet1.hPDU, (short)nID) == true)
      {
         nUser = LEADDICOMNet1.GetUserRole(LEADDICOMNet1.hPDU, (short)nID);
         nProvider = LEADDICOMNet1.GetProviderRole(LEADDICOMNet1.hPDU, (short)nID);
         szOut = szOut + " User: " + System.Convert.ToString(nUser);
         szOut = szOut + " Provider: " + System.Convert.ToString(nProvider) + "\r";
      }
      else
         szOut = szOut + " No Role Select" + "\r";
   }
   MessageBox.Show(szOut);
}