سؤال

HI, I have a requirement to create instance for list object at runtime using reflection. For example I have 2 classes like below,

class Class1
{
   List<Class2> class2List;
   public List<Class2> Class2List
   {
        get;set;
   }
}
class Class2
{
    public string mem1;
    public string mem2;
}

After creating the instance of Class1 at Runtime in another class Class3, I want to assign values to all the properties of the class. In this case, Class2List is a property of List<Class2>. At Runtime, I don't know the class type of List<Class2>. How can I initialize the property i.e. List<Class2> inside class3 at runtime.

Any suggestions are greatly appreciated...

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top