MethodBodyStreamEncoder.AddMethodBody 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.
Overloads
AddMethodBody(InstructionEncoder, Int32, StandaloneSignatureHandle, MethodBodyAttributes) |
Encodes a method body and adds it to the method body stream. |
AddMethodBody(InstructionEncoder, Int32, StandaloneSignatureHandle, MethodBodyAttributes, Boolean) |
Encodes a method body and adds it to the method body stream, using the provided instruction encoder, maximum stack size, local variables' signature handle, method body attributes, and allowing to indicate whether the method should allocate from the dynamic local memory pool or not. |
AddMethodBody(Int32, Int32, Int32, Boolean, StandaloneSignatureHandle, MethodBodyAttributes) |
Encodes a method body and adds it to the method body stream, using the provided code size, maximum stack size, number of exception regions, local variables' signature handle, method body attributes and allowing to indicate whether the exception regions should be encoded in small format or not. |
AddMethodBody(Int32, Int32, Int32, Boolean, StandaloneSignatureHandle, MethodBodyAttributes, Boolean) |
Encodes a method body and adds it to the method body stream, using the provided code size, maximum stack size, number of exception regions, local variables' signature handle, method body attributes, allowing to indicate whether the exception regions should be encoded in small format or not, and allowing to indicate whether the method should allocate from the dynamic local memory pool or not. |
AddMethodBody(InstructionEncoder, Int32, StandaloneSignatureHandle, MethodBodyAttributes)
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
Encodes a method body and adds it to the method body stream.
public:
int AddMethodBody(System::Reflection::Metadata::Ecma335::InstructionEncoder instructionEncoder, int maxStack, System::Reflection::Metadata::StandaloneSignatureHandle localVariablesSignature, System::Reflection::Metadata::Ecma335::MethodBodyAttributes attributes);
public int AddMethodBody (System.Reflection.Metadata.Ecma335.InstructionEncoder instructionEncoder, int maxStack, System.Reflection.Metadata.StandaloneSignatureHandle localVariablesSignature, System.Reflection.Metadata.Ecma335.MethodBodyAttributes attributes);
public int AddMethodBody (System.Reflection.Metadata.Ecma335.InstructionEncoder instructionEncoder, int maxStack = 8, System.Reflection.Metadata.StandaloneSignatureHandle localVariablesSignature = default, System.Reflection.Metadata.Ecma335.MethodBodyAttributes attributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals);
member this.AddMethodBody : System.Reflection.Metadata.Ecma335.InstructionEncoder * int * System.Reflection.Metadata.StandaloneSignatureHandle * System.Reflection.Metadata.Ecma335.MethodBodyAttributes -> int
Public Function AddMethodBody (instructionEncoder As InstructionEncoder, maxStack As Integer, localVariablesSignature As StandaloneSignatureHandle, attributes As MethodBodyAttributes) As Integer
Public Function AddMethodBody (instructionEncoder As InstructionEncoder, Optional maxStack As Integer = 8, Optional localVariablesSignature As StandaloneSignatureHandle = Nothing, Optional attributes As MethodBodyAttributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals) As Integer
Parameters
- instructionEncoder
- InstructionEncoder
The instruction encoder.
- maxStack
- Int32
The maximum stack size.
- localVariablesSignature
- StandaloneSignatureHandle
The local variables' signature handle.
- attributes
- MethodBodyAttributes
The method body attributes.
Returns
The offset of the encoded body within the method body stream.
Exceptions
instructionEncoder
has default value.
maxStack
is out of range [0, UInt16.MaxValue].
A label targeted by a branch in the instruction stream has not been marked, or the distance between a branch instruction and the target label doesn't fit the size of the instruction operand.
Applies to
AddMethodBody(InstructionEncoder, Int32, StandaloneSignatureHandle, MethodBodyAttributes, Boolean)
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
Encodes a method body and adds it to the method body stream, using the provided instruction encoder, maximum stack size, local variables' signature handle, method body attributes, and allowing to indicate whether the method should allocate from the dynamic local memory pool or not.
public int AddMethodBody (System.Reflection.Metadata.Ecma335.InstructionEncoder instructionEncoder, int maxStack = 8, System.Reflection.Metadata.StandaloneSignatureHandle localVariablesSignature = default, System.Reflection.Metadata.Ecma335.MethodBodyAttributes attributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals, bool hasDynamicStackAllocation = false);
member this.AddMethodBody : System.Reflection.Metadata.Ecma335.InstructionEncoder * int * System.Reflection.Metadata.StandaloneSignatureHandle * System.Reflection.Metadata.Ecma335.MethodBodyAttributes * bool -> int
Public Function AddMethodBody (instructionEncoder As InstructionEncoder, Optional maxStack As Integer = 8, Optional localVariablesSignature As StandaloneSignatureHandle = Nothing, Optional attributes As MethodBodyAttributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals, Optional hasDynamicStackAllocation As Boolean = false) As Integer
Parameters
- instructionEncoder
- InstructionEncoder
The instruction encoder.
- maxStack
- Int32
The maximum stack size.
- localVariablesSignature
- StandaloneSignatureHandle
The local variables' signature handle.
- attributes
- MethodBodyAttributes
The method body attributes.
- hasDynamicStackAllocation
- Boolean
true
if the method allocates from the dynamic local memory pool (the IL contains the localloc
instruction); false
otherwise.
Returns
The offset of the encoded body within the method body stream.
Exceptions
instructionEncoder
has default value.
maxStack
is out of range [0, UInt16.MaxValue].
A label targeted by a branch in the instruction stream has not been marked, or the distance between a branch instruction and the target label doesn't fit the size of the instruction operand.
Applies to
AddMethodBody(Int32, Int32, Int32, Boolean, StandaloneSignatureHandle, MethodBodyAttributes)
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
Encodes a method body and adds it to the method body stream, using the provided code size, maximum stack size, number of exception regions, local variables' signature handle, method body attributes and allowing to indicate whether the exception regions should be encoded in small format or not.
public:
System::Reflection::Metadata::Ecma335::MethodBodyStreamEncoder::MethodBody AddMethodBody(int codeSize, int maxStack, int exceptionRegionCount, bool hasSmallExceptionRegions, System::Reflection::Metadata::StandaloneSignatureHandle localVariablesSignature, System::Reflection::Metadata::Ecma335::MethodBodyAttributes attributes);
public System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.MethodBody AddMethodBody (int codeSize, int maxStack, int exceptionRegionCount, bool hasSmallExceptionRegions, System.Reflection.Metadata.StandaloneSignatureHandle localVariablesSignature, System.Reflection.Metadata.Ecma335.MethodBodyAttributes attributes);
public System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.MethodBody AddMethodBody (int codeSize, int maxStack = 8, int exceptionRegionCount = 0, bool hasSmallExceptionRegions = true, System.Reflection.Metadata.StandaloneSignatureHandle localVariablesSignature = default, System.Reflection.Metadata.Ecma335.MethodBodyAttributes attributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals);
member this.AddMethodBody : int * int * int * bool * System.Reflection.Metadata.StandaloneSignatureHandle * System.Reflection.Metadata.Ecma335.MethodBodyAttributes -> System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.MethodBody
Public Function AddMethodBody (codeSize As Integer, maxStack As Integer, exceptionRegionCount As Integer, hasSmallExceptionRegions As Boolean, localVariablesSignature As StandaloneSignatureHandle, attributes As MethodBodyAttributes) As MethodBodyStreamEncoder.MethodBody
Public Function AddMethodBody (codeSize As Integer, Optional maxStack As Integer = 8, Optional exceptionRegionCount As Integer = 0, Optional hasSmallExceptionRegions As Boolean = true, Optional localVariablesSignature As StandaloneSignatureHandle = Nothing, Optional attributes As MethodBodyAttributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals) As MethodBodyStreamEncoder.MethodBody
Parameters
- codeSize
- Int32
The number of bytes to be reserved for instructions.
- maxStack
- Int32
The maximum stack size.
- exceptionRegionCount
- Int32
The number of exception regions.
- hasSmallExceptionRegions
- Boolean
true
if the exception regions should be encoded in small format; false
otherwise.
- localVariablesSignature
- StandaloneSignatureHandle
The local variables' signature handle.
- attributes
- MethodBodyAttributes
The method body attributes.
Returns
The offset of the encoded body within the method body stream.
Exceptions
codeSize
, exceptionRegionCount
, or maxStack
is out of the allowed range.
Applies to
AddMethodBody(Int32, Int32, Int32, Boolean, StandaloneSignatureHandle, MethodBodyAttributes, Boolean)
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
- Source:
- MethodBodyStreamEncoder.cs
Encodes a method body and adds it to the method body stream, using the provided code size, maximum stack size, number of exception regions, local variables' signature handle, method body attributes, allowing to indicate whether the exception regions should be encoded in small format or not, and allowing to indicate whether the method should allocate from the dynamic local memory pool or not.
public System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.MethodBody AddMethodBody (int codeSize, int maxStack = 8, int exceptionRegionCount = 0, bool hasSmallExceptionRegions = true, System.Reflection.Metadata.StandaloneSignatureHandle localVariablesSignature = default, System.Reflection.Metadata.Ecma335.MethodBodyAttributes attributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals, bool hasDynamicStackAllocation = false);
member this.AddMethodBody : int * int * int * bool * System.Reflection.Metadata.StandaloneSignatureHandle * System.Reflection.Metadata.Ecma335.MethodBodyAttributes * bool -> System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.MethodBody
Public Function AddMethodBody (codeSize As Integer, Optional maxStack As Integer = 8, Optional exceptionRegionCount As Integer = 0, Optional hasSmallExceptionRegions As Boolean = true, Optional localVariablesSignature As StandaloneSignatureHandle = Nothing, Optional attributes As MethodBodyAttributes = System.Reflection.Metadata.Ecma335.MethodBodyAttributes.InitLocals, Optional hasDynamicStackAllocation As Boolean = false) As MethodBodyStreamEncoder.MethodBody
Parameters
- codeSize
- Int32
The number of bytes to be reserved for instructions.
- maxStack
- Int32
The maximum stack size.
- exceptionRegionCount
- Int32
The number of exception regions.
- hasSmallExceptionRegions
- Boolean
true
if the exception regions should be encoded in small format; false
otherwise.
- localVariablesSignature
- StandaloneSignatureHandle
The local variables' signature handle.
- attributes
- MethodBodyAttributes
The method body attributes.
- hasDynamicStackAllocation
- Boolean
true
if the method allocates from the dynamic local memory pool (the localloc
instruction); false
otherwise.
Returns
The offset of the encoded body within the method body stream.
Exceptions
codeSize
, exceptionRegionCount
, or maxStack
is out of the allowed range.