Hi Jean-Baptiste,

Sorry for bothering you again but I think it would be great if the
support for specifying a generic context were actually extended to the
overload of ModuleDefinition.Import() taking in a MethodReference as
argument.

This is typically needed when you want to import the constuctor info
of a generic type in the following scenario (very similar to the one
discussed earlier via mail)

using .net reflection on a generic type e.g.

public class A<TParam>
{
   public TParam L { get { return null; } }
}

to:
- retrieve a type defined in terms of a generic parameter,
- use the thus retrieved type to instantiate another generic type, say
List<> ,
- get the constructor so as to be able to perform a new of
List<TParam> within A<TParam>

Note: If I use Import on the List<TParam> type, what I get is a
GenericInstanceType instance. I'm not sure I can retrieve a
TypeDefinition from there to iterate through its MethodDefinition
collection (which would be a workaround)

Best regards,
Gabriel

-- 
--
mono-cecil

Reply via email to