Thank you very much, that really helped!

2010/7/6 Jb Evain <[email protected]>

> Hey,
>
> On Tue, Jul 6, 2010 at 7:22 PM, Gábor Kozár <[email protected]> wrote:
> > I was wondering exactly what they are and when are they created? What is
> > their use?
>
> A type or a method spec is simply a specialization of a type. Imagine
> that, in Bar.dll, you have:
>
> class Foo {
> }
>
> When you open Bar.dll in Cecil, you'll have one TypeDefinition, Foo.
> Other assemblies references Bar and using Foo will have to get a
> TypeReference to Foo.
>
> Now imagine you want have the method:
>
> public void Lookup (Foo[] foos, int index, ref Foo foo)
> {
>    foo = foos [index];
> }
>
> The first parameter of Lookup is an array of Foo. Cecil wise, it's an
> ArrayType, with an ElementType being Foo.
> The last parameter, is a ref parameter. Cecil wise, it's a
> ByReferenceType, with an ElementType being Foo.
>
> Both ArrayType and ByReferenceType extend TypeSpecification.
>
> A TypeSpecification is a specific form of a type. Generic instances
> are represented using a GenericInstanceType which is a type spec.
>
> List<Foo>
>
> is a GenericInstanceType, with an ElementType being List, with a
> GenericArgument being Foo.
>
> The same goes for methods.
>
> public static T Baz<T> ()
>
> if a MethodDefinition.
>
> Baz<int>() is a GenericInstanceMethod with an ElementMethod being
> Baz<T> and a GenericArgument being int.
>
> --
> Jb Evain  <[email protected]>
>
> --
> --
> mono-cecil

-- 
--
mono-cecil

Reply via email to