LINQ AsHierarchy() improvements
A few months ago I published an article about my LINQ AsHierarchy extension method. This extension method can be used to convert a flat collection of records to a hierarchical structure of nested collections.
I got a lot of enthusiastic responses and questions and so I decided to improve this technique a little further. So I added a Parent reference in the HierarchyNode object and the AsHierarchy() method has been extended with RootID and MaxDepth parameters.
I also wrote a new article which describes these new features and demonstrates how to use the LINQ to Objects and the new LINQ to SQL AsHierarchy extension methods. Check it out at my personal website: