[Mono-dev] Mono.Cecil: Full names of generic types

Matej Urbas matej.urbas at gmail.com
Mon Jul 24 07:02:55 EDT 2006


On Mon, 2006-07-24 at 12:33 +0200, Jb Evain wrote:
> There is a simpler way. The inheritance tree is like this:
> - TypeReference
>    - TypeSpecification
>      - ArrayType
>      - PointerType
>      - ReferenceType
>      - FunctionPointerType
>      - GenericInstanceType
>      - ModType
>        - ModifierOptional
>        - ModifierRequired
>      - PinnedType
>    - TypeDefinition
>    - GenericParameter
> You can say that if the type is a TypeSpecification, you loop until its 
> ElementType property is not a TypeSpecification itself. You can then 
> check which kind of TypeSpec it is.

Gureat! That voids all my worries, and what is more, the code is much
cleaner and faster when we have tons of TypeReferences that are not of
type TypeSpecifications :D Now I'm really happy!

Thank you!

Well, in any event, it's sad that I don't have the capacity to figure
out such things by myself... well, maybe some day...

> Please note that a visitor approach would probably be much better, and 
> that I'll have to modify Cecil one day to handle this.

Tell me if you need help, would be glad to help :D Cecil sure is a
project worth spending time on.

>  > I see. Do you have a case where we would stumble upon a MethodReference?
>  > I mean, if we go through all types in the MainModule of an assembly,
>  > would we find a method reference with actual arguments specified? Do you
>  > have a C# example of such an occurrence?
> You can find MethodReferences only in the MemberReference collection of 
> the Module. You'll encounter them as operands of the opcodes in the 
> bodies of the methods. They are only markers.
>  > BTW, Cecil rocks! Great work!
> Thanks,

Well, it really does :D (nods) mhm

> Jb


More information about the Mono-devel-list mailing list