Hi,
 I'm trying to do some custom assembly instrumentation and i ran
across an issue trying to determine the type of a particular field.

There is class that looks like this:

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));
     }
}

When i try to instrument this method i loop through the instructions
and find the call to Optional<R>.Special as an ldsfld instruction.
When i try to determine the type i see that the type of the field is
Optional<T>, but within the scope of the method the type is actually
Optional<R>.  What is the solution for determining when a referenced
field has its type determined by a generic parameter in the current
method?

Thanks

-- 
--
mono-cecil

Reply via email to