Table of Contents

Class CodeMappingInfo

Namespace
ICSharpCode.Decompiler.Metadata
Assembly
ICSharpCode.Decompiler.dll

Describes which parts of the (compiler-generated) code belong to which user code. A part could be:

  • the body (method) of a lambda.
  • the MoveNext method of async/yield state machines.
public class CodeMappingInfo
Inheritance
CodeMappingInfo
Inherited Members

Constructors

CodeMappingInfo(PEFile, TypeDefinitionHandle)

Creates a CodeMappingInfo instance using the given module and type.

public CodeMappingInfo(PEFile module, TypeDefinitionHandle type)

Parameters

module PEFile
type TypeDefinitionHandle

Properties

Module

The module containing the code.

public PEFile Module { get; }

Property Value

PEFile

TypeDefinition

The (parent) TypeDef containing the code.

public TypeDefinitionHandle TypeDefinition { get; }

Property Value

TypeDefinitionHandle

Methods

AddMapping(MethodDefinitionHandle, MethodDefinitionHandle)

Adds a bidirectional mapping between parent and part.

public void AddMapping(MethodDefinitionHandle parent, MethodDefinitionHandle part)

Parameters

parent MethodDefinitionHandle
part MethodDefinitionHandle

GetMethodParts(MethodDefinitionHandle)

Returns all parts of a method. A method has at least one part, that is, the method itself. If no parts are found, only the method itself is returned.

public IEnumerable<MethodDefinitionHandle> GetMethodParts(MethodDefinitionHandle method)

Parameters

method MethodDefinitionHandle

Returns

IEnumerable<MethodDefinitionHandle>

GetParentMethod(MethodDefinitionHandle)

Returns the parent of a part. The parent is usually the "calling method" of lambdas, async and yield state machines. The "calling method" has itself as parent. If no parent is found, the method itself is returned.

public MethodDefinitionHandle GetParentMethod(MethodDefinitionHandle method)

Parameters

method MethodDefinitionHandle

Returns

MethodDefinitionHandle