ILGenerator ILGenerator ILGenerator ILGenerator Class

定義

產生 Microsoft Intermediate Language (MSIL) 指令。Generates Microsoft intermediate language (MSIL) instructions.

public ref class ILGenerator : System::Runtime::InteropServices::_ILGenerator
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public class ILGenerator : System.Runtime.InteropServices._ILGenerator
type ILGenerator = class
    interface _ILGenerator
Public Class ILGenerator
Implements _ILGenerator
繼承
ILGeneratorILGeneratorILGeneratorILGenerator
屬性
實作

備註

ILGenerator是用來產生動態元件 (以MethodBuilderConstructorBuilder類別表示) 和獨立動態DynamicMethod方法 (以類別表示) 中方法和構造函式的方法主體。ILGenerator is used to generate method bodies for methods and constructors in dynamic assemblies (represented by the MethodBuilder and ConstructorBuilder classes) and for standalone dynamic methods (represented by the DynamicMethod class). 若要取得ILGenerator, 請ConstructorBuilder.GetILGenerator使用、 DynamicMethod.GetILGeneratorMethodBuilder.GetILGenerator方法。To obtain an ILGenerator, use the ConstructorBuilder.GetILGenerator, DynamicMethod.GetILGenerator, and MethodBuilder.GetILGenerator methods.

MSIL 是用來做為即時 (JIT) 編譯器的輸入。MSIL is used as input to a just-in-time (JIT) compiler.

屬性

ILOffset ILOffset ILOffset ILOffset

在由 ILGenerator 發出的 Microsoft intermediate language (MSIL) 資料流中,取得目前位移 (以位元組為單位)。Gets the current offset, in bytes, in the Microsoft intermediate language (MSIL) stream that is being emitted by the ILGenerator.

方法

BeginCatchBlock(Type) BeginCatchBlock(Type) BeginCatchBlock(Type) BeginCatchBlock(Type)

開始 Catch 區塊。Begins a catch block.

BeginExceptFilterBlock() BeginExceptFilterBlock() BeginExceptFilterBlock() BeginExceptFilterBlock()

為篩選的例外狀況開始例外狀況區塊。Begins an exception block for a filtered exception.

BeginExceptionBlock() BeginExceptionBlock() BeginExceptionBlock() BeginExceptionBlock()

為非篩選的例外狀況開始例外狀況區塊。Begins an exception block for a non-filtered exception.

BeginFaultBlock() BeginFaultBlock() BeginFaultBlock() BeginFaultBlock()

在 Microsoft Intermediate Language (MSIL) 資料流上開始例外狀況錯誤區塊。Begins an exception fault block in the Microsoft intermediate language (MSIL) stream.

BeginFinallyBlock() BeginFinallyBlock() BeginFinallyBlock() BeginFinallyBlock()

在 Microsoft Intermediate Language (MSIL) 指令資料流中開始 finally 區塊。Begins a finally block in the Microsoft intermediate language (MSIL) instruction stream.

BeginScope() BeginScope() BeginScope() BeginScope()

開始語彙範圍 (Lexical Scope)。Begins a lexical scope.

DeclareLocal(Type) DeclareLocal(Type) DeclareLocal(Type) DeclareLocal(Type)

宣告指定型別的區域變數。Declares a local variable of the specified type.

DeclareLocal(Type, Boolean) DeclareLocal(Type, Boolean) DeclareLocal(Type, Boolean) DeclareLocal(Type, Boolean)

宣告指定型別的區域變數,選擇性固定 (Pin) 變數所參考的物件。Declares a local variable of the specified type, optionally pinning the object referred to by the variable.

DefineLabel() DefineLabel() DefineLabel() DefineLabel()

宣告新的標記。Declares a new label.

Emit(OpCode) Emit(OpCode) Emit(OpCode) Emit(OpCode)

放置指定的指令到指令資料流中。Puts the specified instruction onto the stream of instructions.

Emit(OpCode, Byte) Emit(OpCode, Byte) Emit(OpCode, Byte) Emit(OpCode, Byte)

放置指定的指令和字元引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and character argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, ConstructorInfo) Emit(OpCode, ConstructorInfo) Emit(OpCode, ConstructorInfo) Emit(OpCode, ConstructorInfo)

放置指定建構函式的指定指令和中繼資料 (Metadata) 語彙基元到指令的 Microsoft Intermediate Language (MSIL) 資料流中。Puts the specified instruction and metadata token for the specified constructor onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, Double) Emit(OpCode, Double) Emit(OpCode, Double) Emit(OpCode, Double)

放置指定的指令和數值引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, FieldInfo) Emit(OpCode, FieldInfo) Emit(OpCode, FieldInfo) Emit(OpCode, FieldInfo)

放置指定欄位的指定指令和中繼資料語彙基元到指令的 Microsoft Intermediate Language (MSIL) 資料流中。Puts the specified instruction and metadata token for the specified field onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, Int16) Emit(OpCode, Int16) Emit(OpCode, Int16) Emit(OpCode, Int16)

放置指定的指令和數值引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, Int32) Emit(OpCode, Int32) Emit(OpCode, Int32) Emit(OpCode, Int32)

放置指定的指令和數值引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, Int64) Emit(OpCode, Int64) Emit(OpCode, Int64) Emit(OpCode, Int64)

放置指定的指令和數值引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, Label) Emit(OpCode, Label) Emit(OpCode, Label) Emit(OpCode, Label)

放置指定的指令到 Microsoft Intermediate Language (MSIL) 資料流中,並留下空間,以便在完成修復時加入標記。Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream and leaves space to include a label when fixes are done.

Emit(OpCode, Label[]) Emit(OpCode, Label[]) Emit(OpCode, Label[]) Emit(OpCode, Label[])

放置指定的指令到 Microsoft Intermediate Language (MSIL) 資料流中,並留下空間,以便在完成修復時加入標記。Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream and leaves space to include a label when fixes are done.

Emit(OpCode, LocalBuilder) Emit(OpCode, LocalBuilder) Emit(OpCode, LocalBuilder) Emit(OpCode, LocalBuilder)

放置指定的指令到 Microsoft Intermediate Language (MSIL) 資料流,然後放置指定區域變數的索引。Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the index of the given local variable.

Emit(OpCode, MethodInfo) Emit(OpCode, MethodInfo) Emit(OpCode, MethodInfo) Emit(OpCode, MethodInfo)

放置指定的指令到 Microsoft Intermediate Language (MSIL) 資料流,然後放置指定方法的中繼資料語彙基元。Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given method.

Emit(OpCode, SByte) Emit(OpCode, SByte) Emit(OpCode, SByte) Emit(OpCode, SByte)

放置指定的指令和字元引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and character argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, SignatureHelper) Emit(OpCode, SignatureHelper) Emit(OpCode, SignatureHelper) Emit(OpCode, SignatureHelper)

放置指定的指令和簽章語彙基元到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and a signature token onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, Single) Emit(OpCode, Single) Emit(OpCode, Single) Emit(OpCode, Single)

放置指定的指令和數值引數到指令的 Microsoft Intermediate Language (MSIL) 資料流。Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions.

Emit(OpCode, String) Emit(OpCode, String) Emit(OpCode, String) Emit(OpCode, String)

放置指定的指令到 Microsoft Intermediate Language (MSIL) 資料流,然後放置指定字串的中繼資料語彙基元。Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given string.

Emit(OpCode, Type) Emit(OpCode, Type) Emit(OpCode, Type) Emit(OpCode, Type)

放置指定的指令到 Microsoft Intermediate Language (MSIL) 資料流,然後放置指定型別的中繼資料語彙基元。Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given type.

EmitCall(OpCode, MethodInfo, Type[]) EmitCall(OpCode, MethodInfo, Type[]) EmitCall(OpCode, MethodInfo, Type[]) EmitCall(OpCode, MethodInfo, Type[])

callcallvirt 指令放置於 Microsoft Intermediate Language (MSIL) 資料流中,以呼叫 varargs 方法。Puts a call or callvirt instruction onto the Microsoft intermediate language (MSIL) stream to call a varargs method.

EmitCalli(OpCode, CallingConvention, Type, Type[]) EmitCalli(OpCode, CallingConvention, Type, Type[]) EmitCalli(OpCode, CallingConvention, Type, Type[]) EmitCalli(OpCode, CallingConvention, Type, Type[])

指定間接呼叫的 Unmanaged 呼叫慣例,將 Calli 指令放置到 Microsoft Intermediate Language (MSIL) 資料流中。Puts a Calli instruction onto the Microsoft intermediate language (MSIL) stream, specifying an unmanaged calling convention for the indirect call.

EmitCalli(OpCode, CallingConventions, Type, Type[], Type[]) EmitCalli(OpCode, CallingConventions, Type, Type[], Type[]) EmitCalli(OpCode, CallingConventions, Type, Type[], Type[]) EmitCalli(OpCode, CallingConventions, Type, Type[], Type[])

指定間接呼叫的 Managed 呼叫慣例,將 Calli 指令放置到 Microsoft Intermediate Language (MSIL) 資料流中。Puts a Calli instruction onto the Microsoft intermediate language (MSIL) stream, specifying a managed calling convention for the indirect call.

EmitWriteLine(FieldInfo) EmitWriteLine(FieldInfo) EmitWriteLine(FieldInfo) EmitWriteLine(FieldInfo)

發出以指定欄位呼叫 WriteLine 所需的 Microsoft Intermediate Language (MSIL)。Emits the Microsoft intermediate language (MSIL) necessary to call WriteLine with the given field.

EmitWriteLine(LocalBuilder) EmitWriteLine(LocalBuilder) EmitWriteLine(LocalBuilder) EmitWriteLine(LocalBuilder)

發出以指定本機變數呼叫 WriteLine 所需的 Microsoft 中繼語言 (MSIL)。Emits the Microsoft intermediate language (MSIL) necessary to call WriteLine with the given local variable.

EmitWriteLine(String) EmitWriteLine(String) EmitWriteLine(String) EmitWriteLine(String)

發出 Microsoft Intermediate Language (MSIL),以字串呼叫 WriteLineEmits the Microsoft intermediate language (MSIL) to call WriteLine with a string.

EndExceptionBlock() EndExceptionBlock() EndExceptionBlock() EndExceptionBlock()

結束例外狀況區塊。Ends an exception block.

EndScope() EndScope() EndScope() EndScope()

結束語彙範圍。Ends a lexical scope.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MarkLabel(Label) MarkLabel(Label) MarkLabel(Label) MarkLabel(Label)

以指定標記來標示 Microsoft Intermediate Language (MSIL) 資料流的目前位置。Marks the Microsoft intermediate language (MSIL) stream's current position with the given label.

MarkSequencePoint(ISymbolDocumentWriter, Int32, Int32, Int32, Int32) MarkSequencePoint(ISymbolDocumentWriter, Int32, Int32, Int32, Int32) MarkSequencePoint(ISymbolDocumentWriter, Int32, Int32, Int32, Int32) MarkSequencePoint(ISymbolDocumentWriter, Int32, Int32, Int32, Int32)

標記 Microsoft Intermediate Language (MSIL) 資料流中的序列點。Marks a sequence point in the Microsoft intermediate language (MSIL) stream.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ThrowException(Type) ThrowException(Type) ThrowException(Type) ThrowException(Type)

發出擲回例外狀況的指令。Emits an instruction to throw an exception.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
UsingNamespace(String) UsingNamespace(String) UsingNamespace(String) UsingNamespace(String)

指定要用來評估區域變數的命名空間 (Namespace),並注意目前作用的語彙範圍。Specifies the namespace to be used in evaluating locals and watches for the current active lexical scope.

明確介面實作

_ILGenerator.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _ILGenerator.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _ILGenerator.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _ILGenerator.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。Maps a set of names to a corresponding set of dispatch identifiers.

_ILGenerator.GetTypeInfo(UInt32, UInt32, IntPtr) _ILGenerator.GetTypeInfo(UInt32, UInt32, IntPtr) _ILGenerator.GetTypeInfo(UInt32, UInt32, IntPtr) _ILGenerator.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。Retrieves the type information for an object, which can then be used to get the type information for an interface.

_ILGenerator.GetTypeInfoCount(UInt32) _ILGenerator.GetTypeInfoCount(UInt32) _ILGenerator.GetTypeInfoCount(UInt32) _ILGenerator.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

_ILGenerator.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _ILGenerator.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _ILGenerator.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _ILGenerator.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。Provides access to properties and methods exposed by an object.

適用於