ILGenerator.Emit Method (OpCode, MethodInfo)

 

Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given method.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public virtual void Emit(
	OpCode opcode,
	MethodInfo meth
)

Parameters

opcode
Type: System.Reflection.Emit.OpCode

The MSIL instruction to be emitted onto the stream.

meth
Type: System.Reflection.MethodInfo

A MethodInfo representing a method.

Exception Condition
ArgumentNullException

meth is null.

NotSupportedException

meth is a generic method for which the MethodInfo.IsGenericMethodDefinition property is false.

The instruction values are defined in the OpCodes enumeration.

The location of meth is recorded so that the instruction stream can be patched if necessary when persisting the module to a portable executable (PE) file.

If meth represents a generic method, it must be a generic method definition. That is, its MethodInfo.IsGenericMethodDefinition property must be true.

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top
Show: