I'd like to convert result from methodInfo.InvokeGenericType() object to IEnumerable. I know this type only during runtime. I can't use generics. Please provide an example with the solution. I am not able to figure it out.
Type type = GetRuntimeType(typeName);
MethodInfo genericMethod = method.MakeGenericMethod(type);
object result = genericMethod.Invoke(this, new object[] {});
// var convertedResult = (IEnumerable<type>)result;
I want result to be converted to IEnumerable
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire