Last active
November 30, 2015 13:56
-
-
Save VisualBean/62ab4d94f9b7efdf332d to your computer and use it in GitHub Desktop.
Creating a tree from a flat list of "Organizations"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parents.foreach(p => p.childs = parents.Where(pa => pa.ParentId == p.Id)); | |
return parents.Where(p => p.Id == null); //Returns the very top of the tree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment