If i use a type defined on the same assembly everything works ok with the
afore mentioned code.

2011/1/20 José F. Romaniello <[email protected]>

> actually, i've something like this:
>
> private static TypeReference CloseInterface(
> TypeReference @interface,
> IEnumerable<TypeReference> genericArguments)
> {
> if ([email protected]) return @interface;
> var genericInstanceType = new GenericInstanceType(@interface.Resolve());
>  genericInstanceType.GenericArguments.AddRange(genericArguments);
> return genericInstanceType;
> }
>
> and:
>
> myGenericInstanceType.Resolve().Interfaces( i =>
> i.CloseInterface(myGenericInstanceType.Arguments))
>
> and the interfaces in the debugger seems ok, but when I try to add these
> interfaces to the type, save the assembly and call peverify:
>
>
> [MD]: Error: Signature contains long form (such as ELEMENT_TYPE_CLASS<token 
> of System.String>). [token:0x1B000002]
>
> Another interesting thing in the debugger is that genericargument from the
> original code has this:
> http://screencast.com/t/Jg1UxFI50PxD
> I don't know if it is ok..
>
> thanks again
>
>
> 2011/1/20 José F. Romaniello <[email protected]>
>
> Hi, all I am very new to Mono.Cecil and I've a doubt regarding to
>> generics,
>>
>> I have something like:
>>
>> public class IFoo<T>
>> {
>>   T Property{ get; set; }
>> }
>>
>> public class Foo<T> : IFoo<T>
>> {
>>   public T Property {get;set; }
>> }
>>
>> somewhere on the same assembly, I have "Foo<int>"
>> in my cecil code I can access to that Foo<int> and i get a
>> GenericInstanceType, with his GenericArguments (in this case only one:
>> int)
>>
>> I want to get the closed interfaces from the GenericInstanceType.
>>
>> Thank you in advance
>>
>> --
>> --
>> mono-cecil
>
>
>

-- 
--
mono-cecil

Reply via email to