title: C# path list to tree with objects
body: <p>I need to build a tree list with objects from a path list. The code below works, but I'm unable to retrieve the full path from the search function. See code in bold...</p>
  
  <pre><code>public List&lt;RestoreTreeViewModel&gt; BuildTree(IEnumerable&lt;string&gt; strings)
  {
      return (
        from path in strings
        let split = path.Split('\\')
        group path by path.Split('\\')[0] into g
        select new RestoreTreeViewModel()
        {
            Name = g.Key,
            Nodetype = 2,
            CanReference = true,
            **FullPath = path;**
            Children = BuildTree(            
              from s in g
              where s.Length &gt; g.Key.Length + 1
              select s.Substring(g.Key.Length + 1)) 
        }
        ).ToList();
  }
  </code></pre>
  
  <p>Can this work or should I investigate another way to build the tree from the path list?</p>