Table of Contents

Class MetadataModule

Namespace
ICSharpCode.Decompiler.TypeSystem
Assembly
ICSharpCode.Decompiler.dll

Type system implementation for Metadata.PEFile.

public class MetadataModule : IModule, ISymbol, ICompilationProvider
Inheritance
MetadataModule
Implements
Inherited Members
Extension Methods

Properties

AssemblyName

Gets the assembly name (short name).

public string AssemblyName { get; }

Property Value

string

AssemblyVersion

Gets the assembly version.

public Version AssemblyVersion { get; }

Property Value

Version

Compilation

Gets the parent compilation. This property never returns null.

public ICompilation Compilation { get; }

Property Value

ICompilation

FullAssemblyName

Gets the full assembly name (including public key token etc.)

public string FullAssemblyName { get; }

Property Value

string

IsMainModule

Gets whether this assembly is the main assembly of the compilation.

public bool IsMainModule { get; }

Property Value

bool

PEFile

Gets the underlying metadata file. May return null, if the IAssembly was not created from a PE file.

public PEFile PEFile { get; }

Property Value

PEFile

RootNamespace

public INamespace RootNamespace { get; }

Property Value

INamespace

TopLevelTypeDefinitions

Gets all non-nested types in the assembly.

public IEnumerable<ITypeDefinition> TopLevelTypeDefinitions { get; }

Property Value

IEnumerable<ITypeDefinition>

TypeDefinitions

Gets all types in the assembly, including nested types.

public IEnumerable<ITypeDefinition> TypeDefinitions { get; }

Property Value

IEnumerable<ITypeDefinition>

TypeSystemOptions

public TypeSystemOptions TypeSystemOptions { get; }

Property Value

TypeSystemOptions

Methods

DecodeLocalSignature(StandaloneSignatureHandle, GenericContext)

public ImmutableArray<IType> DecodeLocalSignature(StandaloneSignatureHandle handle, GenericContext genericContext)

Parameters

handle StandaloneSignatureHandle
genericContext GenericContext

Returns

ImmutableArray<IType>

DecodeMethodSignature(StandaloneSignatureHandle, GenericContext)

public (SignatureHeader, FunctionPointerType) DecodeMethodSignature(StandaloneSignatureHandle handle, GenericContext genericContext)

Parameters

handle StandaloneSignatureHandle
genericContext GenericContext

Returns

(SignatureHeader, FunctionPointerType)

GetAssemblyAttributes()

Gets the list of all assembly attributes in the project.

public IEnumerable<IAttribute> GetAssemblyAttributes()

Returns

IEnumerable<IAttribute>

GetDeclaringModule(TypeReferenceHandle)

public IModule GetDeclaringModule(TypeReferenceHandle handle)

Parameters

handle TypeReferenceHandle

Returns

IModule

GetDefinition(EventDefinitionHandle)

public IEvent GetDefinition(EventDefinitionHandle handle)

Parameters

handle EventDefinitionHandle

Returns

IEvent

GetDefinition(FieldDefinitionHandle)

public IField GetDefinition(FieldDefinitionHandle handle)

Parameters

handle FieldDefinitionHandle

Returns

IField

GetDefinition(MethodDefinitionHandle)

public IMethod GetDefinition(MethodDefinitionHandle handle)

Parameters

handle MethodDefinitionHandle

Returns

IMethod

GetDefinition(PropertyDefinitionHandle)

public IProperty GetDefinition(PropertyDefinitionHandle handle)

Parameters

handle PropertyDefinitionHandle

Returns

IProperty

GetDefinition(TypeDefinitionHandle)

public ITypeDefinition GetDefinition(TypeDefinitionHandle handle)

Parameters

handle TypeDefinitionHandle

Returns

ITypeDefinition

GetModuleAttributes()

Gets the list of all module attributes in the project.

public IEnumerable<IAttribute> GetModuleAttributes()

Returns

IEnumerable<IAttribute>

GetTypeDefinition(TopLevelTypeName)

public ITypeDefinition GetTypeDefinition(TopLevelTypeName topLevelTypeName)

Parameters

topLevelTypeName TopLevelTypeName

Returns

ITypeDefinition

InternalsVisibleTo(IModule)

Gets whether the internals of this assembly are visible in the specified assembly.

public bool InternalsVisibleTo(IModule module)

Parameters

module IModule

Returns

bool

ResolveEntity(EntityHandle, GenericContext)

Resolves a symbol.

public IEntity ResolveEntity(EntityHandle entityHandle, GenericContext context = default)

Parameters

entityHandle EntityHandle
context GenericContext

Returns

IEntity

Remarks

  • Types are resolved to their definition, as IType does not implement ISymbol.
    • types without definition will resolve to null
    • use ResolveType() to properly resolve types
  • When resolving methods, varargs signatures are not expanded.
    • use ResolveMethod() instead to get an IMethod instance suitable for call-sites
  • May return specialized members, where generics are involved.
  • Other types of handles that don't correspond to TS entities, will return null.

ResolveMethod(EntityHandle, GenericContext)

public IMethod ResolveMethod(EntityHandle methodReference, GenericContext context)

Parameters

methodReference EntityHandle
context GenericContext

Returns

IMethod

ResolveModule(AssemblyReferenceHandle)

public IModule ResolveModule(AssemblyReferenceHandle handle)

Parameters

handle AssemblyReferenceHandle

Returns

IModule

ResolveModule(ModuleReferenceHandle)

public IModule ResolveModule(ModuleReferenceHandle handle)

Parameters

handle ModuleReferenceHandle

Returns

IModule

ResolveType(EntityHandle, GenericContext, TypeSystemOptions, CustomAttributeHandleCollection?, Nullability)

public IType ResolveType(EntityHandle typeRefDefSpec, GenericContext context, TypeSystemOptions customOptions, CustomAttributeHandleCollection? typeAttributes = null, Nullability nullableContext = Nullability.Oblivious)

Parameters

typeRefDefSpec EntityHandle
context GenericContext
customOptions TypeSystemOptions
typeAttributes CustomAttributeHandleCollection?
nullableContext Nullability

Returns

IType

ResolveType(EntityHandle, GenericContext, CustomAttributeHandleCollection?, Nullability)

public IType ResolveType(EntityHandle typeRefDefSpec, GenericContext context, CustomAttributeHandleCollection? typeAttributes = null, Nullability nullableContext = Nullability.Oblivious)

Parameters

typeRefDefSpec EntityHandle
context GenericContext
typeAttributes CustomAttributeHandleCollection?
nullableContext Nullability

Returns

IType