IList area_list = 从数据路查出ILIST的数据在不转换成TABLE的情况下 能否直接获取里面的值 IList area_list 
点不出来相关属性 目前我只有把他转换成 TABLE 后来获取table.row[][].tostring
每次转 太影响效率了

解决方案 »

  1.   

    用泛型的IList嘛,这样就能用了
    首先定义一个实体类,数据库取出来的时候把每条记录封装成实体后放入IList中就行了
      

  2.   

    IList area_list 
    点不出来相关属性可以点出属性的for(int i=0;i<area_list.count;i++)
    {
    area_list[i].  就出来属性了
    }
      

  3.   

    估计楼主的意思是这样的
    IList a = (DataTable)dt;这样当前出不来属性,而且直接
    a.Rows还会出错要用父类,当然就不能出来子类独有的属性,因为编译器怎么知道这个对象有这个属性?
      

  4.   

    和List一样用,和ArrayList一样用
    循环就可以了
      

  5.   

    public static IList <T> FillList <T>(System.Data.IDataReader reader) 
            { 
                IList <T> lst= new List <T>(); 
                while (reader.Read()) 
                { 
                      T RowInstance = Activator.CreateInstance <T>(); 
                    foreach (PropertyInfo Property in typeof(T).GetProperties()) 
                    { 
                        foreach (BindingFieldAttribute FieldAttr in    Property.GetCustomAttributes(typeof(BindingFieldAttribute), true)) 
                      { 
                      try 
                        { 
      int Ordinal = reader.GetOrdinal(FieldAttr.FieldName); 
                              if (reader.GetValue(Ordinal) != DBNull.Value) 
                              { 
                                    Property.SetValue(RowInstance, Convert.ChangeType(reader.GetValue(Ordinal), Property.PropertyType), null); 
                                } 
                            } 
                            catch 
                            { 
                                break; 
                            } 
                        } 
                    } 
                    lst.Add(RowInstance); 
                } 
                return lst; 
            } 
    遍历取值
      

  6.   

    IList area_list = 从数据路查出ILIST的数据
    if(area_list.count>0)
    {
      for(int i=0;i<area_list.count;i++)
      {
        area_list[i].XXX=....
      }
    }
      

  7.   

    Ilist<>是一个接口,
    Ilist<string> ss = new List<string>();
    ss.add("zhangsan");   //添加
    foreach(string s in ss)
    {
        console.writeLine(s);
    }