List<Empolyee> a=new List<Empolyee>();
a.add(new Employee());
a.add(new Employee());
object obj=a;
Type type=obj.Gettype();
读取List 中的信息.
a.add(new Employee());
a.add(new Employee());
object obj=a;
Type type=obj.Gettype();
读取List 中的信息.
每个EMPLOYEE么?
返回你EMPLOYEE的TYPE
List<char> list = new List<char>();
list.Add('a');
list.Add('b');
list.Add('c');
object a = list;
int length = (int)a.GetType().GetProperty("Count").GetValue(a, null);
for (int i = 0; i < length; i++)
{
MessageBox.Show(a.GetType().GetProperty("Item").GetValue(a, new object[] { i }).ToString());
}
// ...
}
a.Add(new Empolyee());
a.Add(new Empolyee());
object obj = a;
Type type = obj.GetType();
int length = (int)type.GetProperty("Count").GetValue(a, null);
for (int i = 0; i < length; i++)
{
Empolyee xx = type.GetProperty("Item").GetValue(a, new object[] { i }) as Empolyee;
}