[Mono-list] ldtoken with ByRef, question

Jeroen Frijters jeroen at sumatra.nl
Sat Nov 22 03:52:21 EST 2008

Rodrigo Kumpera wrote:
> As you have found out ldtoken can only reference types and not type
> signatures.

Not true. Spec says:

"The token shall be one of:
A methoddef, methodref or methodspec: pushes a RuntimeMethodHandle
A typedef, typeref, or typespec : pushes a RuntimeTypeHandle
A fielddef or fieldref : pushes a RuntimeFieldHandle"

Now, .NET reflection won't allow ILGenerator.Emit(OpCodes.Ldtoken, typeof(xxx).MakeByRefType()), but if you create the IL in another way (e.g. by using my non-broken IKVM.Reflection.Emit implementation ;-)) you get perfectly valid IL.


More information about the Mono-list mailing list