【发布时间】:2016-01-17 17:35:17
【问题描述】:
我有 4 个“列表”列表,其中包含不同类型的数据(文本),每个列表中的项目数也不相同。从这些列表创建数据表的最佳方法是什么?
例如
class A {
public int id {get; set;}
public string Name {get; set;}
public string detailInfo {get; set;}
}
class B {
public string info {get; set;}
}
class C {
public string Code {get; set;}
}
class D {
public int contact {get; set;}
public int contact2 {get; set;}
public Addr {get; set;}
}
class E {
main() {
IList<A> listA= new List<A>();
IList<B> listB= new List<B>();
IList<C> listC= new List<C>();
IList<D> listC= new List<D>();
}
}
那么从上面的 4 个列表中,创建数据表的最佳方法是什么? 注意:每个列表中的项目数可能会有所不同..
【问题讨论】:
-
你说的是
DataTable类吗?你想要每个列表都有一个DataTable吗?还是一个DataTable用于所有列表?你能解释一下为什么需要这个吗?