Kernel Panic

I have this classes:

public class Class1
{

}

public class Class2
{
private List<Class1> _class1
public List<Class1> PropertyClass1
{
get{ return this._class1; }
set{ this._class1 = value; }
}
}


ok, now, using reflection i have a PropertyInfo. This contains the property 'PropertyClass1'. How i can instantiate a new list of this type
Sample:
List<pInfo.PropertyType.GetGenericArguments[0]> newlist = new List<pInfo.PropertyType.GetGenericArguments[0]>(); //don¡¯t work!

How this correct way to do this

Thanks!


Re: Visual C# General Reflection and Generics

Jetttik

Maybe this will be helpfull =)

Type thisType = _objToClone.GetType();

Assembly asm = Assembly.GetAssembly(thisType);

object obj = asm.CreateInstance(thisType.FullName);






Re: Visual C# General Reflection and Generics

Kernel Panic

This solve my problem
Thanks!




Re: Visual C# General Reflection and Generics

Jetttik

You are welcome