Saturday 15 August 2015

linq to entities - Building Jagged Tree With Parentless Nodes In C# -


I have a list of related items that I need to create the structure of a tree I though some tree nodes of these Mulhin And I want to stick to each of these nodes in the root. LINQ and using my results I've created the following I, however, the nodes can not deal with that no parent branches ....

  var list = from ( O resultList [QueryList.Length - 1] .toList () New GroupItem {ItemCode Selection = o.ItemCode, ItemDescription = o.ItemDescription, Item = (resultList in TG [QueryList.Length - 2] .toList () where tg Do .ParentCode == o.ItemCode new GroupItem, {ItemCode = tg.ItemCode, ItemDescription = tg.ItemDescription, items from t = (resultList [QueryList.Length - 3] where t.ParentCode {ItemCode = t.ItemCode, ItemDescription = T.ItemDescription, item = (resultList from su In == Select tg.ItemCode new GroupItem [QueryList.Length - 4] where su.ParentCode == t.ItemCode new SelectableItem {ItemCode = su.ItemCode, ItemDescription = su.ItemDescription,} Select ToList ())}) Cast .  () ToList (.)}) Cast & lt; SelectableItem & gt ;.) ToList ()}) Cast. & Lt; SelectableItem & gt; () ToList ();   

I really want to do ... what a way to quickly and easily with this object from LINQ?

  root ^ | | ____ node 1 | | | & Lt; ------ Parent Relationships | ________ node 2 | | | | | ____________ node 3 ^ | | If a parent is connected to the root then text after "    

It looks like you do something like this are trying to:

  list lt; From the list & lt; GroupItem & gt; & Gt; Results list = ... var roots = new list & lt; GroupTime & gt; (); ICollection & LT; GroupItem & gt; Original language = root; (Parents in the original constellation) (Parents. ITIMES = NODELWAL. Where (node ​​= & gt; node.Parentcode == guardian) .imcode) .Cast & lt; SelectableItem & gt; (). ToList (); } // Add the original nodes from the root: Roots. Additional Range (nodelevel. Where (node ​​= & gt; node.printcode == faucet)); // Ready to go to the next level: parentLevel = nodeLevel; }    

No comments:

Post a Comment