C# WinForms populating TreeView from List<myObj>

Posted by user743354 on Stack Overflow See other posts from Stack Overflow or by user743354
Published on 2012-04-01T11:15:49Z Indexed on 2012/04/01 11:29 UTC
Read the original article Hit count: 182

I have this structure of classes:

 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<Parameter> Parameters { get; set; }

    public L3Message()
    {
        Parameters = new List<Parameter>();
    }

}

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<Parameter> SubParameters { get; set; }

    public Parameter()
    {
        SubParameters = new List<Parameter>();
    }
}

So, as return type from one of my Methods I have List of L3Messages (List < L3Message >), and I need to map that to TreeView in WinForms (populate TreeView from that List).

If possible, I would like to that in separate thread.

How can I achieve that?

© Stack Overflow or respective owner

Related posts about c#

Related posts about multithreading