GetElementLevel Example for C#

//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestGetElementLevel()
{
   try
   {
      int x = 0;
      int lLevel = 0;
      //Navigate the Data Set as a List, not as a Tree
      //Move to the 20th element, and then find that element's level in the Tree
      LEADDICOM1.EnableMethodErrors = true;
      //move to first element in Data Set
      LEADDICOM1.MoveFirstElement(false);
      //move to the 20th element
      for (x = 2; x <= 20; x++)
      {
         LEADDICOM1.MoveNextElement(false);
      }
      LEADDICOM1.FindTag((int)LEADDICOM1.get_CurrentElement().Tag);
      lLevel = LEADDICOM1.GetElementLevel ( ) ;
      MessageBox.Show("Element: " + LEADDICOM1.get_CurrentTag().Name + " at level " + System.Convert.ToString(lLevel));
      return;
   }
   catch
   {
      MessageBox.Show("Error");
   }
}