Class TypeSlimVisitor<TType, TSimpleType, TArrayType, TStructuralType, TGenericDefinitionType, TGenericType, TGenericParameterType>
Visitor over the structure of a lightweight representation of a type.
Inheritance
Namespace: System.Reflection
Assembly: Nuqleon.Linq.Expressions.Bonsai.dll
Syntax
public abstract class TypeSlimVisitor<TType, TSimpleType, TArrayType, TStructuralType, TGenericDefinitionType, TGenericType, TGenericParameterType> : Object where TSimpleType : TType where TArrayType : TType where TStructuralType : TType where TGenericDefinitionType : TType where TGenericType : TType where TGenericParameterType : TType
Type Parameters
Name | Description |
---|---|
TType | Type representing a type. |
TSimpleType | Type representing a simple type. |
TArrayType | Type representing an array type. |
TStructuralType | Type representing a structural type. |
TGenericDefinitionType | Type representing an open generic type definition. |
TGenericType | Type representing a closed generic type. |
TGenericParameterType | Type representing a generic parameter type. |
Constructors
TypeSlimVisitor()
Declaration
protected TypeSlimVisitor()
Methods
MakeArrayType(ArrayTypeSlim, TType, Nullable<Int32>)
Constructs an array type with the specified element type and rank.
Declaration
protected abstract TArrayType MakeArrayType(ArrayTypeSlim type, TType elementType, Nullable<int> rank)
Parameters
Type | Name | Description |
---|---|---|
ArrayTypeSlim | type | Original type. |
TType | elementType | Element type of the array. |
System.Nullable<System.Int32> | rank | Rank of the array, i.e. the number of dimensions. If the rank is null, the array is single-dimensional. |
Returns
Type | Description |
---|---|
TArrayType | Representation of an array type with the given element type and rank. |
MakeGeneric(GenericTypeSlim, TGenericDefinitionType, ReadOnlyCollection<TType>)
Constructs a closed generic type with the specified type definition and type arguments.
Declaration
protected abstract TGenericType MakeGeneric(GenericTypeSlim type, TGenericDefinitionType typeDefinition, ReadOnlyCollection<TType> arguments)
Parameters
Type | Name | Description |
---|---|---|
GenericTypeSlim | type | Original type. |
TGenericDefinitionType | typeDefinition | Generic type definition. |
System.Collections.ObjectModel.ReadOnlyCollection<TType> | arguments | Generic type arguments. |
Returns
Type | Description |
---|---|
TGenericType | Representation of a closed generic type with the given type definition and type parameters. |
MakeGenericDefinition(GenericDefinitionTypeSlim)
Constructs an open generic type definition with the specified parameter types.
Declaration
protected abstract TGenericDefinitionType MakeGenericDefinition(GenericDefinitionTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
GenericDefinitionTypeSlim | type | Original type. |
Returns
Type | Description |
---|---|
TGenericDefinitionType | Representation of an open generic type definition with the given parameter types. |
MakeStructuralType(StructuralTypeSlim, IEnumerable<KeyValuePair<PropertyInfoSlim, TType>>, IEnumerable<KeyValuePair<PropertyInfoSlim, ReadOnlyCollection<TType>>>)
Constructs a structural type with the specified member types.
Declaration
protected abstract TStructuralType MakeStructuralType(StructuralTypeSlim type, IEnumerable<KeyValuePair<PropertyInfoSlim, TType>> propertyTypes, IEnumerable<KeyValuePair<PropertyInfoSlim, ReadOnlyCollection<TType>>> propertyIndexParameters)
Parameters
Type | Name | Description |
---|---|---|
StructuralTypeSlim | type | Original type. |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<PropertyInfoSlim, TType>> | propertyTypes | Mapping from original properties to new property types. |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<PropertyInfoSlim, System.Collections.ObjectModel.ReadOnlyCollection<TType>>> | propertyIndexParameters | Mapping from original index parameters to new property types. |
Returns
Type | Description |
---|---|
TStructuralType | Representation of a structural type with the given members. |
Visit(ReadOnlyCollection<TypeSlim>)
Visits a collection of types.
Declaration
public ReadOnlyCollection<TType> Visit(ReadOnlyCollection<TypeSlim> types)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | types | Types to visit. |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<TType> | Result of visiting the types. |
Visit(TypeSlim)
Visits the specified type.
Declaration
public virtual TType Visit(TypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TType | Result of the visit. |
VisitAndConvert<TResult>(ReadOnlyCollection<TypeSlim>)
Visits a collection of types.
Declaration
public ReadOnlyCollection<TResult> VisitAndConvert<TResult>(ReadOnlyCollection<TypeSlim> types)
where TResult : TType
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | types | Types to visit. |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<TResult> | Result of visiting the types. |
Type Parameters
Name | Description |
---|---|
TResult |
VisitAndConvert<TResult>(TypeSlim)
Visits and converts a type.
Declaration
public TResult VisitAndConvert<TResult>(TypeSlim type)
where TResult : TType
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TResult | Result of visiting and converting the type. |
Type Parameters
Name | Description |
---|---|
TResult | Type representing the kind of type to convert to. |
VisitArray(ArrayTypeSlim)
Visits an array type.
Declaration
protected virtual TArrayType VisitArray(ArrayTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
ArrayTypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TArrayType | Result of the visit. |
VisitGeneric(GenericTypeSlim)
Visits a close generic type.
Declaration
protected virtual TGenericType VisitGeneric(GenericTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
GenericTypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TGenericType | Result of the visit. |
VisitGenericDefinition(GenericDefinitionTypeSlim)
Visits an open generic type definition.
Declaration
protected virtual TGenericDefinitionType VisitGenericDefinition(GenericDefinitionTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
GenericDefinitionTypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TGenericDefinitionType | Result of the visit. |
VisitGenericParameter(GenericParameterTypeSlim)
Visits a generic parameter type.
Declaration
protected abstract TGenericParameterType VisitGenericParameter(GenericParameterTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
GenericParameterTypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TGenericParameterType | Result of the visit. |
VisitGenericTypeArguments(GenericTypeSlim)
Visits the generic type arguments of a generic type.
Declaration
public ReadOnlyCollection<TType> VisitGenericTypeArguments(GenericTypeSlim genericType)
Parameters
Type | Name | Description |
---|---|---|
GenericTypeSlim | genericType | The generic type whose type arguments to visit. |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<TType> | Result of visiting the generic type arguments. |
VisitSimple(SimpleTypeSlim)
Visits a simple type.
Declaration
protected abstract TSimpleType VisitSimple(SimpleTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
SimpleTypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TSimpleType | Result of the visit. |
VisitStructural(StructuralTypeSlim)
Visits a structural type.
Declaration
protected virtual TStructuralType VisitStructural(StructuralTypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
StructuralTypeSlim | type | Type to visit. |
Returns
Type | Description |
---|---|
TStructuralType | Result of the visit. |