I've been looking everywhere on how to call AddRange Method of a
List<myClassfie ld in Reflection.Emit
My code goes like this
MethodInfo method =
typeof(List<>). MakeGenericType (typeof(myClass )).GetMethod("A ddRange",
BindingFlags.In stance | BindingFlags.Pu blic, null, new Type[] {
typeof(IEnumera ble<>).MakeGene ricType(typeof( myClass)) }, null));
and then the implementation
ilgen.Emit(OpCo des.Ldfld, reflectionField );
ilgen.Emit(OpCo des.Ldarg_1);
ilgen.Emit(OpCo des.Callvirt, method);
on this last line I get a NotSupportedExc eption with message: "Specified
method is not supported."
I'm pretty sure my methodinfo needs a modification but I don't know what to
do.
Please guide me to the right place or post the right method info that i need
to specify for this to work.
List<myClassfie ld in Reflection.Emit
My code goes like this
MethodInfo method =
typeof(List<>). MakeGenericType (typeof(myClass )).GetMethod("A ddRange",
BindingFlags.In stance | BindingFlags.Pu blic, null, new Type[] {
typeof(IEnumera ble<>).MakeGene ricType(typeof( myClass)) }, null));
and then the implementation
ilgen.Emit(OpCo des.Ldfld, reflectionField );
ilgen.Emit(OpCo des.Ldarg_1);
ilgen.Emit(OpCo des.Callvirt, method);
on this last line I get a NotSupportedExc eption with message: "Specified
method is not supported."
I'm pretty sure my methodinfo needs a modification but I don't know what to
do.
Please guide me to the right place or post the right method info that i need
to specify for this to work.