Skip to main content
edited body
Source Link
Hugo Santos
  • 2.3k
  • 1
  • 15
  • 38

So it looks like that even if the results are pretty close, using the method Item.GetChildren() recursively can be a little bit faster thenthan the Item.Axes.GetDescendants().

So it looks like that even if the results are pretty close, using the method Item.GetChildren() recursively can be a little bit faster then the Item.Axes.GetDescendants().

So it looks like that even if the results are pretty close, using the method Item.GetChildren() recursively can be a little bit faster than the Item.Axes.GetDescendants().

deleted 2 characters in body
Source Link
Hugo Santos
  • 2.3k
  • 1
  • 15
  • 38
IEnumerable<Item> kids = FetchAllChildrenItems(Database.GetItem(rootItemId)).ToList();

private IEnumerable<Item> FetchAllChildrenItems(Item p_Item, bool p_ReturnRootItem = false)
{
    if (p_ReturnRootItem) {
        yield return p_Item;
    }

    foreach (IItemItem child in p_Item.GetChildren(ChildListOptions.SkipSorting))
    {
        foreach (IItemItem subChild in FetchAllChildrenItems(child, true)) {
            yield return subChild;
        }
    }
}
IEnumerable<Item> kids = FetchAllChildrenItems(Database.GetItem(rootItemId)).ToList();

private IEnumerable<Item> FetchAllChildrenItems(Item p_Item, bool p_ReturnRootItem = false)
{
    if (p_ReturnRootItem) {
        yield return p_Item;
    }

    foreach (IItem child in p_Item.GetChildren(ChildListOptions.SkipSorting))
    {
        foreach (IItem subChild in FetchAllChildrenItems(child, true)) {
            yield return subChild;
        }
    }
}
IEnumerable<Item> kids = FetchAllChildrenItems(Database.GetItem(rootItemId)).ToList();

private IEnumerable<Item> FetchAllChildrenItems(Item p_Item, bool p_ReturnRootItem = false)
{
    if (p_ReturnRootItem) {
        yield return p_Item;
    }

    foreach (Item child in p_Item.GetChildren(ChildListOptions.SkipSorting))
    {
        foreach (Item subChild in FetchAllChildrenItems(child, true)) {
            yield return subChild;
        }
    }
}
added 5 characters in body
Source Link
Hugo Santos
  • 2.3k
  • 1
  • 15
  • 38

So it looks like that even if the results are pretty close, using the method Item.GetChildren() recursively can be a little bit faster then the Item.Axes.GetDescendants().

So it looks like that even if the results are pretty close, using the method Item.GetChildren() recursively can be a little bit faster then the Item.GetDescendants().

So it looks like that even if the results are pretty close, using the method Item.GetChildren() recursively can be a little bit faster then the Item.Axes.GetDescendants().

added 638 characters in body
Source Link
Hugo Santos
  • 2.3k
  • 1
  • 15
  • 38
Loading
Source Link
Hugo Santos
  • 2.3k
  • 1
  • 15
  • 38
Loading