通过反射得到list<T>,把得到的属性等动态绑定到treeview上,如何操作,请帮忙,最好有例子,谢谢。

解决方案 »

  1.   

    TreeView 是递归的,你绑定规则是咋样的,T是什么数据类型?
      

  2.   

    public static list<表名> 方法名{
    var ds = 语句
    return ds;
      

  3.   

     List<T> list = new List<T>();
                Type t = list.GetType();
                PropertyInfo pItem = t.GetProperty("Item", BindingFlags.Public | BindingFlags.Instance);
                PropertyInfo pCount = t.GetProperty("Count", BindingFlags.Public | BindingFlags.Instance);
               
    foreach(T t in lst)
    {
    Type t = typeof(t);  
    FieldInfo[] info = t.GetFields();  PropertyInfo[] properties = user.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
    foreach (PropertyInfo p in properties)
    {
    if (p != null)
    {}
    }
    }
      

  4.   

    绑定三列?
    就是如
    名称
       人生如梦
       bruno_323
    值 
       22
       33
    类型
       男
       女
    一类的么?请说的清楚点,这样大家才能帮到你