Esempio n. 1
0
    /// <summary>
    /// Count the number of items below the given item including the item itself
    /// </summary>
    /// <returns>The number of items found</returns>
    public int CountDescendants()
    {
      int count = 1;
      if (this.Item.HasChildren)
      {
        for (int i = 0; i < this.Item.Children.Count; i++)
        {
          var inspector = new ItemInspector(this.Item.Children[i]);
          count += inspector.CountDescendants();
        }
      }

      return count;
    }
Esempio n. 2
0
 public static int CountChildren(Item item)
 {
   var inspector = new ItemInspector(item);
   return inspector.CountDescendants();
 }