ModuleBuilder.GetTypeToken Method (Type)

 

Returns the token used to identify the specified type within this module.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public TypeToken GetTypeToken(
	Type type
)

Parameters

type
Type: System.Type

The type object that represents the class type.

Return Value

Type: System.Reflection.Emit.TypeToken

The token used to identify the given type within this module.

Exception Condition
ArgumentException

type is a ByRef type.

ArgumentNullException

type is null.

InvalidOperationException

This is a non-transient module that references a transient module.

Tokens are used in Microsoft intermediate language (MSIL) instructions to identify objects. Tokens are relative to the module in which they are contained. For example, the token value for String is likely to be different from module to module. When GetTypeToken is invoked, a reference is added to the module. The reference becomes a permanent part of the module; multiple calls with the same argument have no additional effect.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show: