mscorlib(4.0.0.0) API with additions
System.ModuleHandle Struct Reference

Represents a runtime handle for a module. More...

Collaboration diagram for System.ModuleHandle:
[legend]

Public Member Functions

internal ModuleHandle (RuntimeModule module)
 
internal RuntimeModule GetRuntimeModule ()
 
internal bool IsNullHandle ()
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
override bool Equals (object obj)
 Returns a T:System.Boolean value indicating whether the specified object is a T:System.ModuleHandle structure, and equal to the current T:System.ModuleHandle. More...
 
bool Equals (ModuleHandle handle)
 Returns a T:System.Boolean value indicating whether the specified T:System.ModuleHandle structure is equal to the current T:System.ModuleHandle. More...
 
static internal IRuntimeMethodInfo GetDynamicMethod (DynamicMethod method, RuntimeModule module, string name, byte[] sig, Resolver resolver)
 
static internal int GetToken (RuntimeModule module)
 
RuntimeTypeHandle GetRuntimeTypeHandleFromMetadataToken (int typeToken)
 Returns a runtime type handle for the type identified by the specified metadata token. More...
 
RuntimeTypeHandle ResolveTypeHandle (int typeToken)
 Returns a runtime type handle for the type identified by the specified metadata token. More...
 
RuntimeTypeHandle ResolveTypeHandle (int typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
 Returns a runtime type handle for the type identified by the specified metadata token, specifying the generic type arguments of the type and method where the token is in scope. More...
 
RuntimeMethodHandle GetRuntimeMethodHandleFromMetadataToken (int methodToken)
 Returns a runtime method handle for the method or constructor identified by the specified metadata token. More...
 
RuntimeMethodHandle ResolveMethodHandle (int methodToken)
 Returns a runtime method handle for the method or constructor identified by the specified metadata token. More...
 
RuntimeMethodHandle ResolveMethodHandle (int methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
 Returns a runtime method handle for the method or constructor identified by the specified metadata token, specifying the generic type arguments of the type and method where the token is in scope. More...
 
RuntimeFieldHandle GetRuntimeFieldHandleFromMetadataToken (int fieldToken)
 Returns a runtime handle for the field identified by the specified metadata token. More...
 
RuntimeFieldHandle ResolveFieldHandle (int fieldToken)
 Returns a runtime handle for the field identified by the specified metadata token. More...
 
RuntimeFieldHandle ResolveFieldHandle (int fieldToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
 Returns a runtime field handle for the field identified by the specified metadata token, specifying the generic type arguments of the type and method where the token is in scope. More...
 
static internal void GetModuleType (RuntimeModule handle, ObjectHandleOnStack type)
 
static internal int GetMDStreamVersion (RuntimeModule module)
 

Static Public Member Functions

static bool operator== (ModuleHandle left, ModuleHandle right)
 Tests whether two T:System.ModuleHandle structures are equal. More...
 
static bool operator != (ModuleHandle left, ModuleHandle right)
 Tests whether two T:System.ModuleHandle structures are unequal. More...
 
internal static unsafe RuntimeType ResolveTypeHandleInternal (RuntimeModule module, int typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
 
static internal IRuntimeMethodInfo ResolveMethodHandleInternal (RuntimeModule module, int methodToken)
 
static internal IRuntimeMethodInfo ResolveMethodHandleInternal (RuntimeModule module, int methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
 
internal static unsafe RuntimeMethodHandleInternal ResolveMethodHandleInternalCore (RuntimeModule module, int methodToken, IntPtr[] typeInstantiationContext, int typeInstCount, IntPtr[] methodInstantiationContext, int methodInstCount)
 
internal static unsafe IRuntimeFieldInfo ResolveFieldHandleInternal (RuntimeModule module, int fieldToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
 
static internal bool ContainsPropertyMatchingHash (RuntimeModule module, int propertyToken, uint hash)
 
static internal RuntimeAssembly GetAssembly (RuntimeModule module)
 
static internal RuntimeType GetModuleType (RuntimeModule module)
 
static internal void GetPEKind (RuntimeModule module, out PortableExecutableKinds peKind, out ImageFileMachine machine)
 
static internal MetadataImport GetMetadataImport (RuntimeModule module)
 

Static Public Attributes

static readonly ModuleHandle EmptyHandle = GetEmptyMH()
 Represents an empty module handle. More...
 

Properties

int MDStreamVersion [get]
 Gets the metadata stream version. More...
 

Detailed Description

Represents a runtime handle for a module.

Definition at line 12 of file ModuleHandle.cs.

Member Function Documentation

◆ Equals() [1/2]

override bool System.ModuleHandle.Equals ( object  obj)

Returns a T:System.Boolean value indicating whether the specified object is a T:System.ModuleHandle structure, and equal to the current T:System.ModuleHandle.

Parameters
objThe object to be compared with the current T:System.ModuleHandle structure.
Returns
true if obj is a T:System.ModuleHandle structure, and is equal to the current T:System.ModuleHandle structure; otherwise, false.

Definition at line 66 of file ModuleHandle.cs.

◆ Equals() [2/2]

bool System.ModuleHandle.Equals ( ModuleHandle  handle)

Returns a T:System.Boolean value indicating whether the specified T:System.ModuleHandle structure is equal to the current T:System.ModuleHandle.

Parameters
handleThe T:System.ModuleHandle structure to be compared with the current T:System.ModuleHandle.
Returns
true if handle is equal to the current T:System.ModuleHandle structure; otherwise false.

Definition at line 81 of file ModuleHandle.cs.

◆ GetHashCode()

override int System.ModuleHandle.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer that is the hash code for this instance.

Definition at line 52 of file ModuleHandle.cs.

◆ GetRuntimeFieldHandleFromMetadataToken()

RuntimeFieldHandle System.ModuleHandle.GetRuntimeFieldHandleFromMetadataToken ( int  fieldToken)

Returns a runtime handle for the field identified by the specified metadata token.

Parameters
fieldTokenA metadata token that identifies a field in the module.
Returns
A T:System.RuntimeFieldHandle for the field identified by fieldToken .

Definition at line 274 of file ModuleHandle.cs.

◆ GetRuntimeMethodHandleFromMetadataToken()

RuntimeMethodHandle System.ModuleHandle.GetRuntimeMethodHandleFromMetadataToken ( int  methodToken)

Returns a runtime method handle for the method or constructor identified by the specified metadata token.

Parameters
methodTokenA metadata token that identifies a method or constructor in the module.
Returns
A T:System.RuntimeMethodHandle for the method or constructor identified by methodToken .

Definition at line 195 of file ModuleHandle.cs.

◆ GetRuntimeTypeHandleFromMetadataToken()

RuntimeTypeHandle System.ModuleHandle.GetRuntimeTypeHandleFromMetadataToken ( int  typeToken)

Returns a runtime type handle for the type identified by the specified metadata token.

Parameters
typeTokenA metadata token that identifies a type in the module.
Returns
A T:System.RuntimeTypeHandle for the type identified by typeToken .

Definition at line 125 of file ModuleHandle.cs.

◆ operator !=()

static bool System.ModuleHandle.operator != ( ModuleHandle  left,
ModuleHandle  right 
)
static

Tests whether two T:System.ModuleHandle structures are unequal.

Parameters
leftThe T:System.ModuleHandle structure to the left of the inequality operator.
rightThe T:System.ModuleHandle structure to the right of the inequality operator.
Returns
true if the T:System.ModuleHandle structures are unequal; otherwise, false.

Definition at line 101 of file ModuleHandle.cs.

◆ operator==()

static bool System.ModuleHandle.operator== ( ModuleHandle  left,
ModuleHandle  right 
)
static

Tests whether two T:System.ModuleHandle structures are equal.

Parameters
leftThe T:System.ModuleHandle structure to the left of the equality operator.
rightThe T:System.ModuleHandle structure to the right of the equality operator.
Returns
true if the T:System.ModuleHandle structures are equal; otherwise, false.

Definition at line 91 of file ModuleHandle.cs.

◆ ResolveFieldHandle() [1/2]

RuntimeFieldHandle System.ModuleHandle.ResolveFieldHandle ( int  fieldToken)

Returns a runtime handle for the field identified by the specified metadata token.

Parameters
fieldTokenA metadata token that identifies a field in the module.
Returns
A T:System.RuntimeFieldHandle for the field identified by fieldToken .
Exceptions
T:System.BadImageFormatExceptionmetadataToken is not a valid token in the scope of the current module.-or- metadataToken is not a token for a field in the scope of the current module.-or- metadataToken identifies a field whose parent TypeSpec has a signature containing element type var or mvar.
T:System.InvalidOperationExceptionThe method is called on an empty field handle.

Definition at line 287 of file ModuleHandle.cs.

◆ ResolveFieldHandle() [2/2]

RuntimeFieldHandle System.ModuleHandle.ResolveFieldHandle ( int  fieldToken,
RuntimeTypeHandle []  typeInstantiationContext,
RuntimeTypeHandle []  methodInstantiationContext 
)

Returns a runtime field handle for the field identified by the specified metadata token, specifying the generic type arguments of the type and method where the token is in scope.

Parameters
fieldTokenA metadata token that identifies a field in the module.
typeInstantiationContextAn array of T:System.RuntimeTypeHandle structures representing the generic type arguments of the type where the token is in scope, or null if that type is not generic.
methodInstantiationContextAn array of T:System.RuntimeTypeHandle structures representing the generic type arguments of the method where the token is in scope, or null if that method is not generic.
Returns
A T:System.RuntimeFieldHandle for the field identified by fieldToken .
Exceptions
T:System.BadImageFormatExceptionmetadataToken is not a valid token in the scope of the current module.-or- metadataToken is not a token for a field in the scope of the current module.-or- metadataToken identifies a field whose parent TypeSpec has a signature containing element type var or mvar.
T:System.InvalidOperationExceptionThe method is called on an empty field handle.
T:System.ArgumentOutOfRangeExceptionfieldToken is not a valid token.

Definition at line 304 of file ModuleHandle.cs.

◆ ResolveMethodHandle() [1/2]

RuntimeMethodHandle System.ModuleHandle.ResolveMethodHandle ( int  methodToken)

Returns a runtime method handle for the method or constructor identified by the specified metadata token.

Parameters
methodTokenA metadata token that identifies a method or constructor in the module.
Returns
A T:System.RuntimeMethodHandle for the method or constructor identified by methodToken .
Exceptions
T:System.BadImageFormatExceptionmethodToken is not a valid metadata token for a method in the current module.-or- metadataToken is not a token for a method or constructor in the scope of the current module.-or- metadataToken is a MethodSpec whose signature contains element type var or mvar.
T:System.InvalidOperationExceptionThe method is called on an empty method handle.

Definition at line 208 of file ModuleHandle.cs.

◆ ResolveMethodHandle() [2/2]

RuntimeMethodHandle System.ModuleHandle.ResolveMethodHandle ( int  methodToken,
RuntimeTypeHandle []  typeInstantiationContext,
RuntimeTypeHandle []  methodInstantiationContext 
)

Returns a runtime method handle for the method or constructor identified by the specified metadata token, specifying the generic type arguments of the type and method where the token is in scope.

Parameters
methodTokenA metadata token that identifies a method or constructor in the module.
typeInstantiationContextAn array of T:System.RuntimeTypeHandle structures representing the generic type arguments of the type where the token is in scope, or null if that type is not generic.
methodInstantiationContextAn array of T:System.RuntimeTypeHandle structures representing the generic type arguments of the method where the token is in scope, or null if that method is not generic.
Returns
A T:System.RuntimeMethodHandle for the method or constructor identified by methodToken .
Exceptions
T:System.BadImageFormatExceptionmethodToken is not a valid metadata token for a method in the current module.-or- metadataToken is not a token for a method or constructor in the scope of the current module.-or- metadataToken is a MethodSpec whose signature contains element type var or mvar.
T:System.InvalidOperationExceptionThe method is called on an empty method handle.
T:System.ArgumentOutOfRangeExceptionmethodToken is not a valid token.

Definition at line 230 of file ModuleHandle.cs.

◆ ResolveTypeHandle() [1/2]

RuntimeTypeHandle System.ModuleHandle.ResolveTypeHandle ( int  typeToken)

Returns a runtime type handle for the type identified by the specified metadata token.

Parameters
typeTokenA metadata token that identifies a type in the module.
Returns
A T:System.RuntimeTypeHandle for the type identified by typeToken .
Exceptions
T:System.BadImageFormatExceptiontypeToken is not a valid metadata token for a type in the current module.-or- metadataToken is not a token for a type in the scope of the current module.-or- metadataToken is a TypeSpec whose signature contains element type var or mvar.
T:System.InvalidOperationExceptionThe method is called on an empty type handle.

Definition at line 138 of file ModuleHandle.cs.

◆ ResolveTypeHandle() [2/2]

RuntimeTypeHandle System.ModuleHandle.ResolveTypeHandle ( int  typeToken,
RuntimeTypeHandle []  typeInstantiationContext,
RuntimeTypeHandle []  methodInstantiationContext 
)

Returns a runtime type handle for the type identified by the specified metadata token, specifying the generic type arguments of the type and method where the token is in scope.

Parameters
typeTokenA metadata token that identifies a type in the module.
typeInstantiationContextAn array of T:System.RuntimeTypeHandle structures representing the generic type arguments of the type where the token is in scope, or null if that type is not generic.
methodInstantiationContextAn array of T:System.RuntimeTypeHandle structures objects representing the generic type arguments of the method where the token is in scope, or null if that method is not generic.
Returns
A T:System.RuntimeTypeHandle for the type identified by typeToken .
Exceptions
T:System.BadImageFormatExceptiontypeToken is not a valid metadata token for a type in the current module.-or- metadataToken is not a token for a type in the scope of the current module.-or- metadataToken is a TypeSpec whose signature contains element type var or mvar.
T:System.InvalidOperationExceptionThe method is called on an empty type handle.
T:System.ArgumentOutOfRangeExceptiontypeToken is not a valid token.

Definition at line 155 of file ModuleHandle.cs.

Member Data Documentation

◆ EmptyHandle

readonly ModuleHandle System.ModuleHandle.EmptyHandle = GetEmptyMH()
static

Represents an empty module handle.

Definition at line 15 of file ModuleHandle.cs.

Property Documentation

◆ MDStreamVersion

int System.ModuleHandle.MDStreamVersion
get

Gets the metadata stream version.

Returns
A 32-bit integer representing the metadata stream version. The high-order two bytes represent the major version number, and the low-order two bytes represent the minor version number.

Definition at line 22 of file ModuleHandle.cs.


The documentation for this struct was generated from the following file: