What is fundamental/Performance difference between item.Axes.GetDescendants()
and item.Axes.selectitems()
in sitecore?
item.Axes.GetDescendants()
get all the descendants of the item
using Sitecore API. It calls item.Children
, and then for each child again child.Children
recursively. And it adds all those items to an array.
item.Axes.Selectitems(string query)
executes Sitecore query passed in the argument in the context of the current item.
So those 2 methods are completely different.
item.Axes.selectitems() selects the items based on query provided.It is always good idea to use item.Axes.selectitems() in sitecore instead of GetDescendents as Get Descendents always fetch the child items recursively and has huge performance hit if child items are large in size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With