I have this code:

 static class x<T>
    {
        private class c
        {
            public static readonly c _9 =new c();
            public static Func<T, object> _9__0_0;

            public object b__0_0(T t)
            {
                return new object();
            }
        }

        public static Func<T, object> m0()
        {
            return x<T>.c._9__0_0 = new Func<T, object>(x<T>.c._9.b__0_0);
        }
    }

I want to get b___0_0(T t) method by call GetMethodFromHandle 
<https://msdn.microsoft.com/en-us/library/ms145377(v=vs.110).aspx>with 
method handle and type.

How can I get the method with an instantiated generic parameter

I tried this:

     if(method.DeclaringType.HasGenericParameters)
     {
         var genericType = 
method.DeclaringType.MakeGenericInstanceType(method.DeclaringType.GenericParameters.ToArray());
         var methodRef = new MethodReference(
             method.Name,
             method.ReturnType,
             genericType);
         method.Parameters.ToList().ForEach(p => 
methodRef.Parameters.Add(p));
         processor.Emit(OpCodes.Ldtoken, methodRef);
         processor.Emi(OpCodes.Ldtoken, genericType);
         //Call GetMethodFromHandle
     }

but this code gave me b__0_0(System._Canon)

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to