mscorlib(4.0.0.0) API with additions
System.Reflection.Emit Namespace Reference

Classes

class  AssemblyBuilder
 Defines and represents a dynamic assembly. More...
 
class  ConstructorBuilder
 Defines and represents a constructor of a dynamic class. More...
 
class  CustomAttributeBuilder
 Helps build custom attributes. More...
 
class  DynamicILInfo
 Provides support for alternative ways to generate the Microsoft intermediate language (MSIL) and metadata for a dynamic method, including methods for creating tokens and for inserting the code, exception handling, and local variable signature blobs. More...
 
class  DynamicMethod
 Defines and represents a dynamic method that can be compiled, executed, and discarded. Discarded methods are available for garbage collection. More...
 
class  EnumBuilder
 Describes and represents an enumeration type. More...
 
class  EventBuilder
 Defines events for a class. More...
 
struct  EventToken
 Represents the Token returned by the metadata to represent an event. More...
 
struct  ExceptionHandler
 Represents an exception handler in a byte array of IL to be passed to a method such as M:System.Reflection.Emit.MethodBuilder.SetMethodBody(System.Byte[],System.Int32,System.Byte[],System.Collections.Generic.IEnumerable<System.Reflection.Emit.ExceptionHandler>,System.Collections.Generic.IEnumerable<System.Int32>). More...
 
class  FieldBuilder
 Defines and represents a field. This class cannot be inherited. More...
 
struct  FieldToken
 The FieldToken struct is an object representation of a token that represents a field. More...
 
class  GenericTypeParameterBuilder
 Defines and creates generic type parameters for dynamically defined generic types and methods. This class cannot be inherited. More...
 
class  ILGenerator
 Generates Microsoft intermediate language (MSIL) instructions. More...
 
struct  Label
 Represents a label in the instruction stream. Label is used in conjunction with the T:System.Reflection.Emit.ILGenerator class. More...
 
class  LocalBuilder
 Represents a local variable within a method or constructor. More...
 
class  MethodBuilder
 Defines and represents a method (or constructor) on a dynamic class. More...
 
class  MethodRental
 Provides a fast way to swap method body implementation given a method of a class. More...
 
struct  MethodToken
 The MethodToken struct is an object representation of a token that represents a method. More...
 
class  ModuleBuilder
 Defines and represents a module in a dynamic assembly. More...
 
struct  OpCode
 Describes an intermediate language (IL) instruction. More...
 
class  OpCodes
 Provides field representations of the Microsoft Intermediate Language (MSIL) instructions for emission by the T:System.Reflection.Emit.ILGenerator class members (such as M:System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode)). More...
 
class  ParameterBuilder
 Creates or associates parameter information. More...
 
struct  ParameterToken
 The ParameterToken struct is an opaque representation of the token returned by the metadata to represent a parameter. More...
 
class  PropertyBuilder
 Defines the properties for a type. More...
 
struct  PropertyToken
 The PropertyToken struct is an opaque representation of the Token returned by the metadata to represent a property. More...
 
class  SignatureHelper
 Provides methods for building signatures. More...
 
struct  SignatureToken
 Represents the Token returned by the metadata to represent a signature. More...
 
struct  StringToken
 Represents a token that represents a string. More...
 
class  TypeBuilder
 Defines and creates new instances of classes during run time. More...
 
struct  TypeToken
 Represents the Token returned by the metadata to represent a type. More...
 
class  UnmanagedMarshal
 Represents the class that describes how to marshal a field from managed to unmanaged code. This class cannot be inherited. More...
 

Enumerations

enum  AssemblyBuilderAccess {
  AssemblyBuilderAccess.Run = 0x1, AssemblyBuilderAccess.Save = 0x2, AssemblyBuilderAccess.RunAndSave = 0x3, AssemblyBuilderAccess.ReflectionOnly = 0x6,
  AssemblyBuilderAccess.RunAndCollect = 0x9
}
 Defines the access modes for a dynamic assembly. More...
 
enum  DynamicAssemblyFlags {
  None = 0x0, AllCritical = 0x1, Aptca = 0x2, Critical = 0x4,
  Transparent = 0x8, TreatAsSafe = 0x10
}
 
enum  FlowControl {
  FlowControl.Branch, FlowControl.Break, FlowControl.Call, FlowControl.Cond_Branch,
  FlowControl.Meta, FlowControl.Next, FlowControl.Phi, FlowControl.Return,
  FlowControl.Throw
}
 Describes how an instruction alters the flow of control. More...
 
enum  OpCodeType {
  OpCodeType.Annotation, OpCodeType.Macro, OpCodeType.Nternal, OpCodeType.Objmodel,
  OpCodeType.Prefix, OpCodeType.Primitive
}
 Describes the types of the Microsoft intermediate language (MSIL) instructions. More...
 
enum  OpCodeValues {
  Nop = 0, Break = 1, Ldarg_0 = 2, Ldarg_1 = 3,
  Ldarg_2 = 4, Ldarg_3 = 5, Ldloc_0 = 6, Ldloc_1 = 7,
  Ldloc_2 = 8, Ldloc_3 = 9, Stloc_0 = 10, Stloc_1 = 11,
  Stloc_2 = 12, Stloc_3 = 13, Ldarg_S = 14, Ldarga_S = 0xF,
  Starg_S = 0x10, Ldloc_S = 17, Ldloca_S = 18, Stloc_S = 19,
  Ldnull = 20, Ldc_I4_M1 = 21, Ldc_I4_0 = 22, Ldc_I4_1 = 23,
  Ldc_I4_2 = 24, Ldc_I4_3 = 25, Ldc_I4_4 = 26, Ldc_I4_5 = 27,
  Ldc_I4_6 = 28, Ldc_I4_7 = 29, Ldc_I4_8 = 30, Ldc_I4_S = 0x1F,
  Ldc_I4 = 0x20, Ldc_I8 = 33, Ldc_R4 = 34, Ldc_R8 = 35,
  Dup = 37, Pop = 38, Jmp = 39, Call = 40,
  Calli = 41, Ret = 42, Br_S = 43, Brfalse_S = 44,
  Brtrue_S = 45, Beq_S = 46, Bge_S = 47, Bgt_S = 48,
  Ble_S = 49, Blt_S = 50, Bne_Un_S = 51, Bge_Un_S = 52,
  Bgt_Un_S = 53, Ble_Un_S = 54, Blt_Un_S = 55, Br = 56,
  Brfalse = 57, Brtrue = 58, Beq = 59, Bge = 60,
  Bgt = 61, Ble = 62, Blt = 0x3F, Bne_Un = 0x40,
  Bge_Un = 65, Bgt_Un = 66, Ble_Un = 67, Blt_Un = 68,
  Switch = 69, Ldind_I1 = 70, Ldind_U1 = 71, Ldind_I2 = 72,
  Ldind_U2 = 73, Ldind_I4 = 74, Ldind_U4 = 75, Ldind_I8 = 76,
  Ldind_I = 77, Ldind_R4 = 78, Ldind_R8 = 79, Ldind_Ref = 80,
  Stind_Ref = 81, Stind_I1 = 82, Stind_I2 = 83, Stind_I4 = 84,
  Stind_I8 = 85, Stind_R4 = 86, Stind_R8 = 87, Add = 88,
  Sub = 89, Mul = 90, Div = 91, Div_Un = 92,
  Rem = 93, Rem_Un = 94, And = 95, Or = 96,
  Xor = 97, Shl = 98, Shr = 99, Shr_Un = 100,
  Neg = 101, Not = 102, Conv_I1 = 103, Conv_I2 = 104,
  Conv_I4 = 105, Conv_I8 = 106, Conv_R4 = 107, Conv_R8 = 108,
  Conv_U4 = 109, Conv_U8 = 110, Callvirt = 111, Cpobj = 112,
  Ldobj = 113, Ldstr = 114, Newobj = 115, Castclass = 116,
  Isinst = 117, Conv_R_Un = 118, Unbox = 121, Throw = 122,
  Ldfld = 123, Ldflda = 124, Stfld = 125, Ldsfld = 126,
  Ldsflda = 0x7F, Stsfld = 0x80, Stobj = 129, Conv_Ovf_I1_Un = 130,
  Conv_Ovf_I2_Un = 131, Conv_Ovf_I4_Un = 132, Conv_Ovf_I8_Un = 133, Conv_Ovf_U1_Un = 134,
  Conv_Ovf_U2_Un = 135, Conv_Ovf_U4_Un = 136, Conv_Ovf_U8_Un = 137, Conv_Ovf_I_Un = 138,
  Conv_Ovf_U_Un = 139, Box = 140, Newarr = 141, Ldlen = 142,
  Ldelema = 143, Ldelem_I1 = 144, Ldelem_U1 = 145, Ldelem_I2 = 146,
  Ldelem_U2 = 147, Ldelem_I4 = 148, Ldelem_U4 = 149, Ldelem_I8 = 150,
  Ldelem_I = 151, Ldelem_R4 = 152, Ldelem_R8 = 153, Ldelem_Ref = 154,
  Stelem_I = 155, Stelem_I1 = 156, Stelem_I2 = 157, Stelem_I4 = 158,
  Stelem_I8 = 159, Stelem_R4 = 160, Stelem_R8 = 161, Stelem_Ref = 162,
  Ldelem = 163, Stelem = 164, Unbox_Any = 165, Conv_Ovf_I1 = 179,
  Conv_Ovf_U1 = 180, Conv_Ovf_I2 = 181, Conv_Ovf_U2 = 182, Conv_Ovf_I4 = 183,
  Conv_Ovf_U4 = 184, Conv_Ovf_I8 = 185, Conv_Ovf_U8 = 186, Refanyval = 194,
  Ckfinite = 195, Mkrefany = 198, Ldtoken = 208, Conv_U2 = 209,
  Conv_U1 = 210, Conv_I = 211, Conv_Ovf_I = 212, Conv_Ovf_U = 213,
  Add_Ovf = 214, Add_Ovf_Un = 215, Mul_Ovf = 216, Mul_Ovf_Un = 217,
  Sub_Ovf = 218, Sub_Ovf_Un = 219, Endfinally = 220, Leave = 221,
  Leave_S = 222, Stind_I = 223, Conv_U = 224, Prefix7 = 248,
  Prefix6 = 249, Prefix5 = 250, Prefix4 = 251, Prefix3 = 252,
  Prefix2 = 253, Prefix1 = 254, Prefixref = 0xFF, Arglist = 65024,
  Ceq = 65025, Cgt = 65026, Cgt_Un = 65027, Clt = 65028,
  Clt_Un = 65029, Ldftn = 65030, Ldvirtftn = 65031, Ldarg = 65033,
  Ldarga = 65034, Starg = 65035, Ldloc = 65036, Ldloca = 65037,
  Stloc = 65038, Localloc = 65039, Endfilter = 65041, Unaligned_ = 65042,
  Volatile_ = 65043, Tail_ = 65044, Initobj = 65045, Constrained_ = 65046,
  Cpblk = 65047, Initblk = 65048, Rethrow = 65050, Sizeof = 65052,
  Refanytype = 65053, Readonly_ = 65054
}
 
enum  OperandType {
  OperandType.InlineBrTarget = 0, OperandType.InlineField = 1, OperandType.InlineI = 2, OperandType.InlineI8 = 3,
  OperandType.InlineMethod = 4, OperandType.InlineNone = 5, OperandType.InlinePhi = 6, OperandType.InlineR = 7,
  OperandType.InlineSig = 9, OperandType.InlineString = 10, OperandType.InlineSwitch = 11, OperandType.InlineTok = 12,
  OperandType.InlineType = 13, OperandType.InlineVar = 14, OperandType.ShortInlineBrTarget = 0xF, OperandType.ShortInlineI = 0x10,
  OperandType.ShortInlineR = 17, OperandType.ShortInlineVar = 18
}
 Describes the operand type of Microsoft intermediate language (MSIL) instruction. More...
 
enum  PackingSize {
  PackingSize.Unspecified = 0, PackingSize.Size1 = 1, PackingSize.Size2 = 2, PackingSize.Size4 = 4,
  PackingSize.Size8 = 8, PackingSize.Size16 = 0x10, PackingSize.Size32 = 0x20, PackingSize.Size64 = 0x40,
  PackingSize.Size128 = 0x80
}
 Specifies one of two factors that determine the memory alignment of fields when a type is marshaled. More...
 
enum  PEFileKinds { PEFileKinds.Dll = 1, PEFileKinds.ConsoleApplication, PEFileKinds.WindowApplication }
 Specifies the type of the portable executable (PE) file. More...
 
enum  ScopeAction { Open, Close }
 
enum  StackBehaviour {
  StackBehaviour.Pop0, StackBehaviour.Pop1, StackBehaviour.Pop1_pop1, StackBehaviour.Popi,
  StackBehaviour.Popi_pop1, StackBehaviour.Popi_popi, StackBehaviour.Popi_popi8, StackBehaviour.Popi_popi_popi,
  StackBehaviour.Popi_popr4, StackBehaviour.Popi_popr8, StackBehaviour.Popref, StackBehaviour.Popref_pop1,
  StackBehaviour.Popref_popi, StackBehaviour.Popref_popi_popi, StackBehaviour.Popref_popi_popi8, StackBehaviour.Popref_popi_popr4,
  StackBehaviour.Popref_popi_popr8, StackBehaviour.Popref_popi_popref, StackBehaviour.Push0, StackBehaviour.Push1,
  StackBehaviour.Push1_push1, StackBehaviour.Pushi, StackBehaviour.Pushi8, StackBehaviour.Pushr4,
  StackBehaviour.Pushr8, StackBehaviour.Pushref, StackBehaviour.Varpop, StackBehaviour.Varpush,
  StackBehaviour.Popref_popi_pop1
}
 Describes how values are pushed onto a stack or popped off a stack. More...
 
enum  TypeKind { IsArray = 1, IsPointer, IsByRef }
 

Enumeration Type Documentation

◆ AssemblyBuilderAccess

Defines the access modes for a dynamic assembly.

Enumerator
Run 

The dynamic assembly can be executed, but not saved.

Save 

The dynamic assembly can be saved, but not executed.

RunAndSave 

The dynamic assembly can be executed and saved.

ReflectionOnly 
        The dynamic assembly is loaded into the reflection-only context, and cannot be executed.</summary> 
RunAndCollect 

The dynamic assembly can be unloaded and its memory reclaimed, subject to the restrictions described in Collectible Assemblies for Dynamic Type Generation.

Definition at line 9 of file AssemblyBuilderAccess.cs.

◆ FlowControl

Describes how an instruction alters the flow of control.

Enumerator
Branch 

Branch instruction.

Break 

Break instruction.

Call 

Call instruction.

Cond_Branch 

Conditional branch instruction.

Meta 

Provides information about a subsequent instruction. For example, the Unaligned instruction of Reflection.Emit.Opcodes has FlowControl.Meta and specifies that the subsequent pointer instruction might be unaligned.

Next 

Normal flow of control.

Phi 

This enumerator value is reserved and should not be used.

Return 

Return instruction.

Throw 

Exception throw instruction.

Definition at line 9 of file FlowControl.cs.

◆ OpCodeType

Describes the types of the Microsoft intermediate language (MSIL) instructions.

Enumerator
Annotation 

This enumerator value is reserved and should not be used.

Macro 

These are Microsoft intermediate language (MSIL) instructions that are used as a synonym for other MSIL instructions. For example, ldarg.0 represents the ldarg instruction with an argument of 0.

Nternal 

Describes a reserved Microsoft intermediate language (MSIL) instruction.

Objmodel 

Describes a Microsoft intermediate language (MSIL) instruction that applies to objects.

Prefix 

Describes a prefix instruction that modifies the behavior of the following instruction.

Primitive 

Describes a built-in instruction.

Definition at line 9 of file OpCodeType.cs.

◆ OperandType

Describes the operand type of Microsoft intermediate language (MSIL) instruction.

Enumerator
InlineBrTarget 

The operand is a 32-bit integer branch target.

InlineField 

The operand is a 32-bit metadata token.

InlineI 

The operand is a 32-bit integer.

InlineI8 

The operand is a 64-bit integer.

InlineMethod 

The operand is a 32-bit metadata token.

InlineNone 

No operand.

InlinePhi 

The operand is reserved and should not be used.

InlineR 

The operand is a 64-bit IEEE floating point number.

InlineSig 

The operand is a 32-bit metadata signature token.

InlineString 

The operand is a 32-bit metadata string token.

InlineSwitch 

The operand is the 32-bit integer argument to a switch instruction.

InlineTok 

The operand is a FieldRef, MethodRef, or TypeRef token.

InlineType 

The operand is a 32-bit metadata token.

InlineVar 

The operand is 16-bit integer containing the ordinal of a local variable or an argument.

ShortInlineBrTarget 

The operand is an 8-bit integer branch target.

ShortInlineI 

The operand is an 8-bit integer.

ShortInlineR 

The operand is a 32-bit IEEE floating point number.

ShortInlineVar 

The operand is an 8-bit integer containing the ordinal of a local variable or an argumenta.

Definition at line 9 of file OperandType.cs.

◆ PackingSize

Specifies one of two factors that determine the memory alignment of fields when a type is marshaled.

Enumerator
Unspecified 

The packing size is not specified.

Size1 

The packing size is 1 byte.

Size2 

The packing size is 2 bytes.

Size4 

The packing size is 4 bytes.

Size8 

The packing size is 8 bytes.

Size16 

The packing size is 16 bytes.

Size32 

The packing size is 32 bytes.

Size64 

The packing size is 64 bytes.

Size128 

The packing size is 128 bytes.

Definition at line 9 of file PackingSize.cs.

◆ PEFileKinds

Specifies the type of the portable executable (PE) file.

Enumerator
Dll 

The portable executable (PE) file is a DLL.

ConsoleApplication 

The application is a console (not a Windows-based) application.

WindowApplication 

The application is a Windows-based application.

Definition at line 8 of file PEFileKinds.cs.

◆ StackBehaviour

Describes how values are pushed onto a stack or popped off a stack.

Enumerator
Pop0 

No values are popped off the stack.

Pop1 

Pops one value off the stack.

Pop1_pop1 

Pops 1 value off the stack for the first operand, and 1 value of the stack for the second operand.

Popi 

Pops a 32-bit integer off the stack.

Popi_pop1 

Pops a 32-bit integer off the stack for the first operand, and a value off the stack for the second operand.

Popi_popi 

Pops a 32-bit integer off the stack for the first operand, and a 32-bit integer off the stack for the second operand.

Popi_popi8 

Pops a 32-bit integer off the stack for the first operand, and a 64-bit integer off the stack for the second operand.

Popi_popi_popi 

Pops a 32-bit integer off the stack for the first operand, a 32-bit integer off the stack for the second operand, and a 32-bit integer off the stack for the third operand.

Popi_popr4 

Pops a 32-bit integer off the stack for the first operand, and a 32-bit floating point number off the stack for the second operand.

Popi_popr8 

Pops a 32-bit integer off the stack for the first operand, and a 64-bit floating point number off the stack for the second operand.

Popref 

Pops a reference off the stack.

Popref_pop1 

Pops a reference off the stack for the first operand, and a value off the stack for the second operand.

Popref_popi 

Pops a reference off the stack for the first operand, and a 32-bit integer off the stack for the second operand.

Popref_popi_popi 

Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a value off the stack for the third operand.

Popref_popi_popi8 

Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 64-bit integer off the stack for the third operand.

Popref_popi_popr4 

Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 32-bit integer off the stack for the third operand.

Popref_popi_popr8 

Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 64-bit floating point number off the stack for the third operand.

Popref_popi_popref 

Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a reference off the stack for the third operand.

Push0 

No values are pushed onto the stack.

Push1 

Pushes one value onto the stack.

Push1_push1 

Pushes 1 value onto the stack for the first operand, and 1 value onto the stack for the second operand.

Pushi 

Pushes a 32-bit integer onto the stack.

Pushi8 

Pushes a 64-bit integer onto the stack.

Pushr4 

Pushes a 32-bit floating point number onto the stack.

Pushr8 

Pushes a 64-bit floating point number onto the stack.

Pushref 

Pushes a reference onto the stack.

Varpop 

Pops a variable off the stack.

Varpush 

Pushes a variable onto the stack.

Popref_popi_pop1 

Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 32-bit integer off the stack for the third operand.

Definition at line 9 of file StackBehaviour.cs.