IncludeVolatile Example for C#

//This example uses the predefined variable “List1” of type “ListBox” from “.NET Framework”.
//This example uses the predefined variable “List2” of type “ListBox” from “.NET Framework”.
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestIncludeVolatile ( )
{
   short nRet = 0;
   LEADDICOM1.EnableMethodErrors = false;
   //list all elements
   LEADDICOM1.IncludeVolatile = true;
   nRet = LEADDICOM1.MoveFirstElement(false);
   while (nRet == 0)
   {
      List1.Items.Add(System.Convert.ToString(LEADDICOM1.get_CurrentElement().Tag));
      nRet = LEADDICOM1.MoveNextElement(false);
   }
   MessageBox.Show("Element Count = " + System.Convert.ToString(List1.Items.Count));
   //list only non-volatile elements
   LEADDICOM1.IncludeVolatile = false;
   nRet = LEADDICOM1.MoveFirstElement(false);
   while (nRet == 0)
   {
      List2.Items.Add(System.Convert.ToString(LEADDICOM1.get_CurrentElement().Tag));
      nRet = LEADDICOM1.MoveNextElement(false);
   }
   MessageBox.Show("Non Volatile Element Count = " + System.Convert.ToString(List2.Items.Count));
}