Hi,

On Mon, Dec 6, 2010 at 12:39 AM, luke <[email protected]> wrote:
> class Optional<T>
> {
>    public static Optional<T> Special = new Optional<T>();
>    public bool IsEmpty(){...}
> //....lots of stuff
>     public Optional<R> Map(Func<T, R> f)
>     {
>          return IsEmpty() ? Optional<R>.Special : new
> Foo<R>(f(Value));
>     }
> }

In the Map function, the ldsfld instruction will have a FieldReference
operand. It's declaring type will be a :

GenericInstanceType
  .GenericArguments [0] = R
  .ElementType = Optional
  .ElementType.GenericParameters [0] = T

It's indeed an instantiation of Optional of T with R.

Jb

-- 
--
mono-cecil

Reply via email to