Upraviť

Zdieľať cez


DynamicILInfo.SetCode Method

Definition

Sets the code body of the associated dynamic method.

Overloads

SetCode(Byte[], Int32)

Sets the code body of the associated dynamic method.

SetCode(Byte*, Int32, Int32)

Sets the code body of the associated dynamic method.

SetCode(Byte[], Int32)

Source:
DynamicILGenerator.cs
Source:
DynamicILGenerator.cs
Source:
DynamicILGenerator.cs

Sets the code body of the associated dynamic method.

public:
 void SetCode(cli::array <System::Byte> ^ code, int maxStackSize);
public void SetCode (byte[]? code, int maxStackSize);
public void SetCode (byte[] code, int maxStackSize);
member this.SetCode : byte[] * int -> unit
Public Sub SetCode (code As Byte(), maxStackSize As Integer)

Parameters

code
Byte[]

An array that contains the MSIL stream.

maxStackSize
Int32

The maximum number of items on the operand stack when the method is executing.

Remarks

No validity checks are performed on the MSIL stream.

Calling this method a second time replaces the first MSIL stream with the second.

Generating your own metadata and MSIL requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". For more information, see ECMA 335 Common Language Infrastructure (CLI).

Applies to

SetCode(Byte*, Int32, Int32)

Source:
DynamicILGenerator.cs
Source:
DynamicILGenerator.cs
Source:
DynamicILGenerator.cs

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Reflection.Emit.DynamicILInfo.SetCode(Byte[], Int32)

Sets the code body of the associated dynamic method.

public:
 void SetCode(System::Byte* code, int codeSize, int maxStackSize);
[System.CLSCompliant(false)]
public void SetCode (byte* code, int codeSize, int maxStackSize);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public void SetCode (byte* code, int codeSize, int maxStackSize);
[<System.CLSCompliant(false)>]
member this.SetCode : nativeptr<byte> * int * int -> unit
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
member this.SetCode : nativeptr<byte> * int * int -> unit

Parameters

code
Byte*

A pointer to a byte array containing the MSIL stream.

codeSize
Int32

The number of bytes in the MSIL stream.

maxStackSize
Int32

The maximum number of items on the operand stack when the method is executing.

Attributes

Exceptions

code is null and codeSize is greater than 0.

codeSize is less than 0.

Remarks

No validity checks are performed on the MSIL stream.

Calling this method a second time replaces the first MSIL stream with the second.

Generating your own metadata and MSIL requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set." For more information, see ECMA 335 Common Language Infrastructure (CLI).

Applies to