MethodBuilder.SetMethodBody Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates the body of the method by using a specified byte array of Microsoft intermediate language (MSIL) instructions.
public:
void SetMethodBody(cli::array <System::Byte> ^ il, int maxStack, cli::array <System::Byte> ^ localSignature, System::Collections::Generic::IEnumerable<System::Reflection::Emit::ExceptionHandler> ^ exceptionHandlers, System::Collections::Generic::IEnumerable<int> ^ tokenFixups);
public void SetMethodBody (byte[] il, int maxStack, byte[] localSignature, System.Collections.Generic.IEnumerable<System.Reflection.Emit.ExceptionHandler> exceptionHandlers, System.Collections.Generic.IEnumerable<int> tokenFixups);
member this.SetMethodBody : byte[] * int * byte[] * seq<System.Reflection.Emit.ExceptionHandler> * seq<int> -> unit
Public Sub SetMethodBody (il As Byte(), maxStack As Integer, localSignature As Byte(), exceptionHandlers As IEnumerable(Of ExceptionHandler), tokenFixups As IEnumerable(Of Integer))
Parameters
- il
- Byte[]
An array that contains valid MSIL instructions.
- maxStack
- Int32
The maximum stack evaluation depth.
- localSignature
- Byte[]
An array of bytes that contain the serialized local variable structure. Specify null
if the method has no local variables.
- exceptionHandlers
- IEnumerable<ExceptionHandler>
A collection that contains the exception handlers for the method. Specify null
if the method has no exception handlers.
- tokenFixups
- IEnumerable<Int32>
A collection of values that represent offsets in il
, each of which specifies the beginning of a token that may be modified. Specify null
if the method has no tokens that have to be modified.
Exceptions
il
is null
.
maxStack
is negative.
-or-
One of exceptionHandlers
specifies an offset outside of il
.
-or-
One of tokenFixups
specifies an offset that is outside the il
array.
The containing type was previously created using the CreateType() method.
-or-
This method was called previously on this MethodBuilder object.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈