I was wondering if there is any known difference (mostly performance related) between those two methods of retrieving all children of a given Item.
The first one will give me all levels of children in one shot.
On the second approach, I have to build some code to recursively get the same result, since Item.GetChildren()
only returns the first level.
I don't know why but I had a feeling that the Item.Axes.GetDescendants()
was always slower, but using DotPeek to see what is going on under the hoods now I'm no longer sure.
Item.Axes.GetDescendants()
It uses the item.Children
property.
Which ends up calling ItemManager.GetChildren(this._ownerItem, (ChildListOptions.IgnoreSecurity & options) != ChildListOptions.None ? SecurityCheck.Disable : SecurityCheck.Enable).InnerChildren
Recursive Item.GetChildren()
Which is also ItemManager.GetChildren(this, (options & ChildListOptions.IgnoreSecurity) != ChildListOptions.None ? SecurityCheck.Disable : SecurityCheck.Enable, options)