Show / Hide Table of Contents

Class TypeVisitor<TResult>

Base class for visitor for CLR types, based on their structure.

Inheritance
System.Object
TypeVisitor<TResult>
TypeToTypeSlimConverter
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public abstract class TypeVisitor<TResult> : Object
Type Parameters
Name Description
TResult

Type of the result of the visit.

Constructors

TypeVisitor()

Declaration
protected TypeVisitor()

Methods

MakeArrayType(Type, TResult)

Constructs a single-dimensional vector array type from the specified element type.

Declaration
protected abstract TResult MakeArrayType(Type type, TResult elementType)
Parameters
Type Name Description
System.Type type

The original type.

TResult elementType

Element type of the array.

Returns
Type Description
TResult

Representation of a single-dimensional vector array type with the given element type.

MakeArrayType(Type, TResult, Int32)

Constructs a multi-dimensional array type from the specified element type and rank.

Declaration
protected abstract TResult MakeArrayType(Type type, TResult elementType, int rank)
Parameters
Type Name Description
System.Type type

The original type.

TResult elementType

Element type of the array.

System.Int32 rank

Rank (the number of dimensions) of the array.

Returns
Type Description
TResult

Representation of a multi-dimensional array type with the given element type and rank.

MakeByRefType(Type, TResult)

Constructs a by ref type from the specified element type.

Declaration
protected abstract TResult MakeByRefType(Type type, TResult elementType)
Parameters
Type Name Description
System.Type type

The original type.

TResult elementType

Element type of the array.

Returns
Type Description
TResult

Representation of a by ref type with the given element type.

MakeGenericType(Type, TResult, TResult[])

Constructs a closed generic type from the specified generic type definition and type arguments.

Declaration
protected abstract TResult MakeGenericType(Type type, TResult genericTypeDefinition, params TResult[] genericArguments)
Parameters
Type Name Description
System.Type type

The original type.

TResult genericTypeDefinition

Generic type definition.

TResult[] genericArguments

Generic type arguments.

Returns
Type Description
TResult

Representation of a closed generic type with the given generic type definition and type arguments.

MakePointerType(Type, TResult)

Constructs a pointer type from the specified element type.

Declaration
protected abstract TResult MakePointerType(Type type, TResult elementType)
Parameters
Type Name Description
System.Type type

The original type.

TResult elementType

Element type of the array.

Returns
Type Description
TResult

Representation of a pointer type with the given element type.

Visit(IEnumerable<Type>)

Visits a sequence of types.

Declaration
protected virtual IEnumerable<TResult> Visit(IEnumerable<Type> types)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Type> types

Sequence of types to visit.

Returns
Type Description
System.Collections.Generic.IEnumerable<TResult>

Sequence consisting of the result of visiting each type in the original sequence.

Visit(Type)

Visits a CLR type.

Declaration
public virtual TResult Visit(Type type)
Parameters
Type Name Description
System.Type type

Type to visit.

Returns
Type Description
TResult

Result after the visit.

Visit(Type[])

Visits an array of types.

Declaration
protected virtual TResult[] Visit(Type[] types)
Parameters
Type Name Description
System.Type[] types

Array of types to visit.

Returns
Type Description
TResult[]

Array consisting of the result of visiting each type in the original sequence.

VisitArray(Type)

Visits all array types and dispatches into VisitArrayVector or VisitArrayMultidimensional.

Declaration
protected virtual TResult VisitArray(Type type)
Parameters
Type Name Description
System.Type type

Array type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitArrayMultidimensional(Type)

Visits a multi-dimensional array type.

Declaration
protected virtual TResult VisitArrayMultidimensional(Type type)
Parameters
Type Name Description
System.Type type

Multi-dimensional array type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitArrayVector(Type)

Visits a single-dimensional array type, also known as a vector.

Declaration
protected virtual TResult VisitArrayVector(Type type)
Parameters
Type Name Description
System.Type type

Single-dimensional array type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitByRef(Type)

Visits a by ref type.

Declaration
protected virtual TResult VisitByRef(Type type)
Parameters
Type Name Description
System.Type type

By ref type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitGeneric(Type)

Visits types that are generic and dispatches into VisitGenericClosed or VisitGenericTypeDefinition. Notice this method does not dispatch into VisitGenericParameter, because a generic parameter is not categorized as a generic type.

Declaration
protected virtual TResult VisitGeneric(Type type)
Parameters
Type Name Description
System.Type type

Generic type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitGenericClosed(Type)

Visits a closed generic type.

Declaration
protected virtual TResult VisitGenericClosed(Type type)
Parameters
Type Name Description
System.Type type

Closed generic type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitGenericParameter(Type)

Visits a generic parameter.

Declaration
protected abstract TResult VisitGenericParameter(Type type)
Parameters
Type Name Description
System.Type type

Generic parameter to visit.

Returns
Type Description
TResult

Result after the visit.

VisitGenericTypeDefinition(Type)

Visits a generic type definition.

Declaration
protected abstract TResult VisitGenericTypeDefinition(Type type)
Parameters
Type Name Description
System.Type type

Generic type definition to visit.

Returns
Type Description
TResult

Result after the visit.

VisitPointer(Type)

Visits a pointer type.

Declaration
protected virtual TResult VisitPointer(Type type)
Parameters
Type Name Description
System.Type type

Pointer type to visit.

Returns
Type Description
TResult

Result after the visit.

VisitSimple(Type)

Visits a type with no internal structure.

Declaration
protected abstract TResult VisitSimple(Type type)
Parameters
Type Name Description
System.Type type

Simple type to visit.

Returns
Type Description
TResult

Result after the visit.

In This Article
Back to top Generated by DocFX