Today's EPiServer tip - GetDescendents

by Fredrik Karlsson 26. February 2009 23:01

I recently found out about a new method in EPiServer CMS 5 R2, the GetDescendents method. It returns all children to a page, not just level one children like the GetChildren method, but all children.

The code is really easy:

EPiServer.DataFactory.Instance.ProviderMap.GetPageProvider("MyPageProvider").GetDescendents(PageReference.StartPage);

Or just go the fast way:

EPiServer.DataFactory.Instance.GetDescendents(PageReference.StartPage);

You can see the SDK entry here.

And the best part is that it returns an IList<PageReference> and not your normal PageReferenceCollection. Could this be a new era in EPiServer? I for one would welcome the change from PageDataCollections to IList<PageData> or IEnumerable<PageData>. Specially now with LINQ and all you can do with generic lists.

Tags:

Development

blog comments powered by Disqus

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 Sweden License.


Welcome to the Dropit blog!

Here we, the people that work at Dropit, will write about stuff that interests us. For example web development, especially with .NET and EPiServer - but we'll also talk about other techniques that interest us, marketing on the web, social phenomenons, pop culture, games and software development in general.