Share via


ModuleBuilder.GetTypeToken Method (Type)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function GetTypeToken ( _
    type As Type _
) As TypeToken
[SecuritySafeCriticalAttribute]
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.

Exceptions

Exception Condition
ArgumentException

type is a ByRef type.

ArgumentNullException

type is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

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

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.