The syntax !n is a reference to a common argument.
In this example ...
!0 is a reference to the first common argument Func<double, double> (used as the argument type of the Invoke method)
!1 is a reference to the second common common argument Func<double, double> (used as the return type of Invoke )
EDIT : your method uses System.Reflection.Emit ...
var dynamicMethod = new DynamicMethod( "f2Dynamic", typeof(double), new Type[] { typeof(Func<double, double>), typeof(double) }); var il = dynamicMethod.GetILGenerator(); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_1); il.Emit(OpCodes.Callvirt, typeof(Func<double, double>).GetMethod("Invoke")); il.Emit(OpCodes.Ret); var f2Dynamic = (Func<Func<double, double>, double, double>)dynamicMethod.CreateDelegate( typeof(Func<Func<double, double>, double, double>)); Console.WriteLine(f2(x => x * x, 10.0));
EDIT2 : fixed explanation !n after @kvb prompt
ulrichb
source share