Table of Contents

Class CorLibTypeFactory

Namespace
AsmResolver.DotNet.Signatures
Assembly
AsmResolver.DotNet.dll

Provides a mechanism for obtaining commonly used element type signatures in various blob signatures, defined in the common object runtime library, such as mscorlib (for .NET framework) or System.Private.CorLib (for .NET Core).

public class CorLibTypeFactory
Inheritance
CorLibTypeFactory
Inherited Members

Constructors

CorLibTypeFactory(IResolutionScope)

Creates a new factory with the provided resolution scope referencing a common object runtime library.

public CorLibTypeFactory(IResolutionScope corLibScope)

Parameters

corLibScope IResolutionScope

The reference to the common object runtime library.

Properties

Boolean

Gets the element type signature for bool.

public CorLibTypeSignature Boolean { get; }

Property Value

CorLibTypeSignature

Byte

Gets the element type signature for byte.

public CorLibTypeSignature Byte { get; }

Property Value

CorLibTypeSignature

Char

Gets the element type signature for char.

public CorLibTypeSignature Char { get; }

Property Value

CorLibTypeSignature

CorLibScope

Gets the resolution scope referencing the common object runtime (COR) library.

public IResolutionScope CorLibScope { get; }

Property Value

IResolutionScope

Double

Gets the element type signature for double.

public CorLibTypeSignature Double { get; }

Property Value

CorLibTypeSignature

Int16

Gets the element type signature for short.

public CorLibTypeSignature Int16 { get; }

Property Value

CorLibTypeSignature

Int32

Gets the element type signature for int.

public CorLibTypeSignature Int32 { get; }

Property Value

CorLibTypeSignature

Int64

Gets the element type signature for long.

public CorLibTypeSignature Int64 { get; }

Property Value

CorLibTypeSignature

IntPtr

Gets the element type signature for nint.

public CorLibTypeSignature IntPtr { get; }

Property Value

CorLibTypeSignature

Object

Gets the element type signature for object.

public CorLibTypeSignature Object { get; }

Property Value

CorLibTypeSignature

SByte

Gets the element type signature for sbyte.

public CorLibTypeSignature SByte { get; }

Property Value

CorLibTypeSignature

Single

Gets the element type signature for float.

public CorLibTypeSignature Single { get; }

Property Value

CorLibTypeSignature

String

Gets the element type signature for string.

public CorLibTypeSignature String { get; }

Property Value

CorLibTypeSignature

TypedReference

Gets the element type signature for TypedReference.

public CorLibTypeSignature TypedReference { get; }

Property Value

CorLibTypeSignature

UInt16

Gets the element type signature for ushort.

public CorLibTypeSignature UInt16 { get; }

Property Value

CorLibTypeSignature

UInt32

Gets the element type signature for uint.

public CorLibTypeSignature UInt32 { get; }

Property Value

CorLibTypeSignature

UInt64

Gets the element type signature for ulong.

public CorLibTypeSignature UInt64 { get; }

Property Value

CorLibTypeSignature

UIntPtr

Gets the element type signature for nuint.

public CorLibTypeSignature UIntPtr { get; }

Property Value

CorLibTypeSignature

Void

Gets the element type signature for void.

public CorLibTypeSignature Void { get; }

Property Value

CorLibTypeSignature

Methods

CreateMscorlib40TypeFactory(ModuleDefinition)

Creates a new type factory that references mscorlib 4.0.0.0.

public static CorLibTypeFactory CreateMscorlib40TypeFactory(ModuleDefinition module)

Parameters

module ModuleDefinition

Returns

CorLibTypeFactory

The factory.

ExtractDotNetRuntimeInfo()

Maps the corlib reference to the appropriate .NET or .NET Core version.

public DotNetRuntimeInfo ExtractDotNetRuntimeInfo()

Returns

DotNetRuntimeInfo

The runtime information.

FromElementType(ElementType)

Obtains the common object runtime type signature from its element type.

public CorLibTypeSignature? FromElementType(ElementType elementType)

Parameters

elementType ElementType

The element type.

Returns

CorLibTypeSignature

The corlib type, or null if none was found.

FromName(string?, string?)

Obtains the common object runtime type signature by its full name.

public CorLibTypeSignature? FromName(string? ns, string? name)

Parameters

ns string

The namespace.

name string

The name.

Returns

CorLibTypeSignature

The corlib type, or null if none was found.

FromType(ITypeDescriptor)

Transforms the provided type descriptor to a common object runtime type signature.

public CorLibTypeSignature? FromType(ITypeDescriptor type)

Parameters

type ITypeDescriptor

The type to transform to a corlib type signature.

Returns

CorLibTypeSignature

The corlib type, or null if none was found.