title: C# WinForms populating TreeView from List<myObj>
body: <p>I have this structure of classes:</p>
  
  <pre><code>public class L3Message
  {
      public int Number { get; set; }
      public string MessageName { get; set; }
      public string Device { get; set; }
      public string Time { get; set; }
      public string ScramblingCode { get; set; }
  
      public List&lt;Parameter&gt; Parameters { get; set; }
  
      public L3Message()
      {
          Parameters = new List&lt;Parameter&gt;();
      }
  }
  
  public class Parameter
  {
      public int numOfWhitespaces { get; set; }
  
      public string ParameterName { get; set; }
      public string ParameterValue { get; set; }
  
      public Parameter Parent { get; set; }
      public List&lt;Parameter&gt; SubParameters { get; set; }
  
      public Parameter()
      {
          SubParameters = new List&lt;Parameter&gt;();
      }
  }
  </code></pre>
  
  <p>So, as return type from one of my Methods I have <code>List</code> of <code>L3Messages</code> (<code>List&lt;L3Message&gt;</code>), and I need to map that to <code>TreeView</code> in <code>WinForms</code> (populate <code>TreeView</code> from that <code>List</code>).</p>
  
  <p><strong>EDIT:</strong>
  Please notice that tree of my objects can be deeper than one level (becouse class Parameter have prop List &lt; Parmaeter > (List of Parameter object, same structure as root parameter object)), so that means recursion or something like.</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>Here is pic of tree, but this tree is created from text file base on whitespaces, so here is all Parameters, in my tree I need only one from List of L3Message objects.</p>
  
  <p><a href="http://imageshack.us/photo/my-images/803/treeviewmessage.png/" rel="nofollow">http://imageshack.us/photo/my-images/803/treeviewmessage.png/</a></p>
  
  <p><strong>EDIT3:</strong></p>
  
  <p>I'm sure that my TreeView need to be something like this:</p>
  
  <pre><code>L3Message.Number: L3Message.MessageName
  +L3Message.Time
  +L3Message.Device
  +L3Message.ScramblingCode
  +L3Message.Parameters[0]
  ++Parameter.ParamaeterName: Parameter.ParameterValue
  ++ (same as above)
  L3Message.Number: L3Message.MessageName
  +L3Message.Time
  +L3Message.Device
  +L3Message.ScramblingCode
  +L3Message.Parameters[0]
  ++Parameter.ParamaeterName: Parameter.ParameterValue (in this occasion Value is null )
  +++SubParameter.ParameterName: SubParameter.ParameterValue
  </code></pre>
  
  <p>Something like that</p>
  
  <p>If possible, I would like to that in separate thread.</p>
  
  <p>How can I achieve that?</p>