Enumerating the Coded Concepts of a Context Group Example for C#

private bool DisplayCodedConcept(ref LTDICLib.LEADDicomDS objDS, ref bool bYesNo)
{
   bool tempDisplayCodedConcept = false;
   string sTitle = null;
   objDS.MoveCodedConceptGroup();
   sTitle = "Coded Concept (" + objDS.CurrentContextGroup.ContextIdentifier + ")";
   string sMsg = null;
   string sYear = null;
   string sMonth = null;
   string sDay = null;
   // Coding Scheme Designator;
   sMsg = objDS.CurrentCodedConcept.CodingSchemeDesignator + System.Environment.NewLine;
   // Coding Scheme Version
   if (objDS.CurrentCodedConcept.CodingSchemeVersion.Length>0)
      sMsg = sMsg + objDS.CurrentCodedConcept.CodingSchemeVersion + System.Environment.NewLine;
   // Code Value and Code Meaning
   sMsg = sMsg + objDS.CurrentCodedConcept.CodeValue + System.Environment.NewLine + objDS.CurrentCodedConcept.CodeMeaning + System.Environment.NewLine;
   // Context Group Local Version
   if (objDS.CurrentCodedConcept.IsContextGroupLocalVersion)
   {
      sYear = System.Convert.ToString(objDS.CurrentCodedConcept.ContextGroupLocalVersion.Year);
      while (sYear.Length < 4)
      {
         sYear = "0" + sYear;
      }
      sMonth = System.Convert.ToString(objDS.CurrentCodedConcept.ContextGroupLocalVersion.Month);
      if (sMonth.Length < 2)
         sMonth = "0" + sMonth;
      sDay = System.Convert.ToString(objDS.CurrentCodedConcept.ContextGroupLocalVersion.Day);
      if (sDay.Length < 2)
         sDay = "0" + sDay;
      sMsg = sMsg + sYear + sMonth + sDay + System.Environment.NewLine;
   }
   // Context Group Extension Creator UID
   if (objDS.CurrentCodedConcept.ContextGroupExtensionCreatorUID.Length>0)
      sMsg = sMsg + objDS.CurrentCodedConcept.ContextGroupExtensionCreatorUID + System.Environment.NewLine;
   if (bYesNo)
   {
      sMsg = sMsg + System.Environment.NewLine + "Continue?";
      tempDisplayCodedConcept = MessageBox.Show(sMsg, sTitle, MessageBoxButtons.YesNo) == DialogResult.Yes;
   }
   else
   {
      MessageBox.Show(sMsg, sTitle, MessageBoxButtons.OK);
      tempDisplayCodedConcept = true;
   }
   return tempDisplayCodedConcept;
}

private void EnumCodedConcepts(ref LTDICLib.LEADDicomDS objDS)
{
   bool bRet = false;
   // Enumerate the Coded Concepts in the current Context Group (3 possible ways)
   int I = 0;
   if (true)
   {
      // One possible way to enumerate the Coded Concepts
      bRet = objDS.MoveFirstCodedConcept();
      while (bRet)
      {
         bool tempbYesNo1 = true;
         if (! (DisplayCodedConcept(ref objDS, ref tempbYesNo1)))
            break;
         bRet = objDS.MoveNextCodedConcept();
      }
   }
   else if (false)
   {
      // Another way to enumerate the Coded Concepts
      for (I = 0; I < objDS.GetCodedConceptCount(); I++)
      {
         objDS.FindIndexCodedConcept(I);
         bool tempbYesNo3 = true;
         if (! (DisplayCodedConcept(ref objDS, ref tempbYesNo3)))
            break;
      }
   }
   else if (false)
   {
      // A third way to enumerate the Coded Concepts
      bRet = objDS.MoveLastCodedConcept();
      while (bRet)
      {
         bool tempbYesNo4 = true;
         if (! (DisplayCodedConcept(ref objDS, ref tempbYesNo4)))
            break;
         bRet = objDS.MovePrevCodedConcept();
      }
   }
}