Show / Hide Table of Contents

Class GenericContext

Represent a set of information that defines a meaning of generic signature in some context

Inheritance
System.Object
GenericContext
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: CilTools.Reflection
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public class GenericContext
Remarks

A generic context is used with when reading signatures that could potentially contain generic parameters. A generic parameter in signature only encodes its number; getting any additional information, such as a parameter name, requires access to specific generic parameters or arguments being referenced in current context.

Properties

DeclaringMethod

Gets a declaring method in this generic context

Declaration
public MethodBase DeclaringMethod { get; }
Property Value
Type Description
System.Reflection.MethodBase

DeclaringType

Gets a declaring type in this generic context

Declaration
public Type DeclaringType { get; }
Property Value
Type Description
System.Type

MethodArgumentsCount

Gets the number of generic method arguments

Declaration
public int MethodArgumentsCount { get; }
Property Value
Type Description
System.Int32

TypeArgumentsCount

Gets the number of generic type arguments

Declaration
public int TypeArgumentsCount { get; }
Property Value
Type Description
System.Int32

Methods

Create(Type, MethodBase)

Creates a new generic context using the specified declaring members

Declaration
public static GenericContext Create(Type decltype, MethodBase declmethod)
Parameters
Type Name Description
System.Type decltype

Declaring type (could be null)

System.Reflection.MethodBase declmethod

Declaring method (could be null)

Returns
Type Description
GenericContext
Remarks

Pass null values if the generic context is unknown or signature does not use generic parameters

FromArgs(Type[], Type[])

Creates a new generic context using the specified generic arguments

Declaration
public static GenericContext FromArgs(Type[] typeargs, Type[] methodargs)
Parameters
Type Name Description
System.Type[] typeargs

An array of generic type arguments (can be null)

System.Type[] methodargs

An array of generic method arguments (can be null)

Returns
Type Description
GenericContext
Remarks

Pass null values if the generic context is unknown or signature does not use generic parameters

GetMethodArgument(Int32)

Gets a generic method argument at the specified index

Declaration
public Type GetMethodArgument(int i)
Parameters
Type Name Description
System.Int32 i
Returns
Type Description
System.Type

GetTypeArgument(Int32)

Gets a generic type argument at the specified index

Declaration
public Type GetTypeArgument(int i)
Parameters
Type Name Description
System.Int32 i
Returns
Type Description
System.Type
Back to top CIL Tools (published from sources in GitHub repository).
Generated by DocFX