Hey,

On Thu, Jun 3, 2010 at 7:07 PM, Gabriel Kevorkian
<[email protected]> wrote:
> var assembly = AssemblyDefinition.ReadAssembly(@"MyAssembly.dll", new
> ReaderParameters() { ReadSymbols = true });
> var type = assembly.MainModule.Types.FirstOrDefault(t =>
> "A`1".Equals(t.Name));
> var list_of_a =
> type.Module.Import(typeof(List<>).MakeGenericType(typeof(MyAssembly.A<>)),
> type);
>
> and have the T of MyAssembly.A<> be bound according to the context
> passed as extra parameter to Import.
>
> in the current implementation this will yield something of the form
> System.Collections.Generic.List`1<MyAssembly.A`1>

Yeah that's normal.

You have to:

var a_def = typeof (MyAssembly.A<>);
var a_of_t = a_def.MakeGenericType (a_def.GetGenericArguments () [0]);

var list = type.Module.Import (typeof (List<>).MakeGenericType (a_of_t), type);

-- 
Jb Evain  <[email protected]>

-- 
--
mono-cecil

Reply via email to