generics with IL?
问题 Is it possible to use generics with the IL Generator? DynamicMethod method = new DynamicMethod( "GetStuff", typeof(int), new Type[] { typeof(object) }); ILGenerator il = method.GetILGenerator(); ... etc 回答1: Yes, it is possible, but not with the DynamicMethod class. If you are restricted to using this class, you're out of luck. If you can instead use a MethodBuilder object, read on. Emitting the body of a generic method is, for most intents and purposes, no different from emitting the body of