How to get a random item from the tree given a parent node?
Posted
by Bryan
on Stack Overflow
See other posts from Stack Overflow
or by Bryan
Published on 2010-04-06T19:47:12Z
Indexed on
2010/04/06
20:03 UTC
Read the original article
Hit count: 205
sitecore
I have a scenario where I would like to randomize the display of some items. Given a Parent item, how can I randomly select one of its child items?
Of course I could load ALL the children and apply some random index or whatnot... but that would be wildly inefficient.
I'm wondering if this is also inefficient:
Parent.Children[random(Parent.Children.Count)]?
At what point do the items get loaded when you access Parent.Children?
© Stack Overflow or respective owner