ModuleBuilder.GetTypeToken Method

Definition

Returns a type token.

Overloads

GetTypeToken(Type)

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

GetTypeToken(String)

Returns the token used to identify the type with the specified name.

GetTypeToken(Type)

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

public:
 System::Reflection::Emit::TypeToken GetTypeToken(Type ^ type);
public System.Reflection.Emit.TypeToken GetTypeToken (Type type);
member this.GetTypeToken : Type -> System.Reflection.Emit.TypeToken
Public Function GetTypeToken (type As Type) As TypeToken

Parameters

type
Type

The type object that represents the class type.

Returns

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

Exceptions

type is a ByRef type.

type is null.

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.

Applies to

GetTypeToken(String)

Returns the token used to identify the type with the specified name.

public:
 System::Reflection::Emit::TypeToken GetTypeToken(System::String ^ name);
public System.Reflection.Emit.TypeToken GetTypeToken (string name);
member this.GetTypeToken : string -> System.Reflection.Emit.TypeToken
Public Function GetTypeToken (name As String) As TypeToken

Parameters

name
String

The name of the class, including the namespace.

Returns

The token used to identify the type with the specified name within this module.

Exceptions

name is the empty string ("").

-or-

name represents a ByRef type.

name is null.

-or-

The type specified by name could not be found.

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

Remarks

This method is useful for clients of the MethodRental class who want to directly modify the body of a method.

Applies to