Generic List created at runtime
Posted
by Perry
on Stack Overflow
See other posts from Stack Overflow
or by Perry
Published on 2010-03-24T19:24:00Z
Indexed on
2010/03/24
19:33 UTC
Read the original article
Hit count: 345
Hi... i neeed something like this in C#.. have list in class but decide what will be in list during runtime
class A
{
List data;
Type typeOfDataInList;
}
public void FillData(DataTyp[] data) where DataTyp : struct
{
A a = new A();
A.vListuBudouDataTypu = typeof(DataTyp);
A.data = new List();
A.AddRange(data);
}
Is this possible to do something like this ?
© Stack Overflow or respective owner