[Mono-dev] Mono.Cecil: Full names of generic types
Matej Urbas
matej.urbas at gmail.com
Sat Jul 22 12:12:35 EDT 2006
On Sat, 2006-07-22 at 16:29 +0200, Alejandro Serrano wrote:
>
> Decorating generic types with a grave (`) and the
> number of generic parameters is the way the CLI
> represents generic types, so we could have:
>
> Func<A> => Func`1<A>
> Func<A, B> => Func`2<A, B>
>
> because the runtime imposes that all types must have
> different names. It is well documented in the ECMA
> Standard papers for the CLI.
Thanks, I thought as much. But still, when displaying the name of such
types in code completion, those '`#' suffixes must be removed. Ok, so
there's no other way but to truncate - I understand, period. :)
There is still one question open, though:
I still have to know about (generic) parameters in methods (see the
example in my previous post). It seems that the only way to obtain
generic arguments for a method's parameter is to parse its full name. Or
should there be a collection of generic parameters for method's
parameters too?
You see, all Mono.Cecil.TypeReference and Mono.Cecil.TypeDefinition have
a GenericParameters property, but for all method's parameters it is
always empty (although they too can have generic parameters e.g.: void
MyMethod(List<String> names) <--- here 'names' should have a generic
parameter 'String', but its GenericParameters collection is empty).
Hehe, you must know that I'm just asking - I don't want to reinvent the
wheel, you see. If it's not possible, I will have to parse those names -
period... but imagine just how funny it would be to parse such a
parameter: void MyMethod(List< MyClass< MyClass2<String> > >
strangeParam ), when on the other hand I could just grab all those
generic parameters from a collection :D
So, do I have to parse generic parameters from the names?
Enjoy,
---
Matej
More information about the Mono-devel-list
mailing list