Interface ITypeShapeVisitor
- Namespace
- PolyType.Abstractions
- Assembly
- PolyType.dll
Provides a visitor for strongly-typed traversal of .NET types.
public interface ITypeShapeVisitor
Methods
VisitConstructorParameter<TArgumentState, TParameterType>(IConstructorParameterShape<TArgumentState, TParameterType>, object?)
Visits an IConstructorParameterShape<TArgumentState, TParameterType> instance.
object? VisitConstructorParameter<TArgumentState, TParameterType>(IConstructorParameterShape<TArgumentState, TParameterType> parameterShape, object? state = null)
Parameters
parameterShape
IConstructorParameterShape<TArgumentState, TParameterType>The parameter shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
TArgumentState
The constructor argument state type used for aggregating constructor arguments.
TParameterType
The type of the visited constructor parameter.
VisitConstructor<TDeclaringType, TArgumentState>(IConstructorShape<TDeclaringType, TArgumentState>, object?)
Visits an IConstructorParameterShape<TArgumentState, TParameterType> instance.
object? VisitConstructor<TDeclaringType, TArgumentState>(IConstructorShape<TDeclaringType, TArgumentState> constructorShape, object? state = null)
Parameters
constructorShape
IConstructorShape<TDeclaringType, TArgumentState>The constructor shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
TDeclaringType
The declaring type of the visited constructor.
TArgumentState
The state type used for aggregating constructor arguments.
VisitDictionary<TDictionary, TKey, TValue>(IDictionaryTypeShape<TDictionary, TKey, TValue>, object?)
Visits an IDictionaryTypeShape<TDictionary, TKey, TValue> instance representing a dictionary type.
object? VisitDictionary<TDictionary, TKey, TValue>(IDictionaryTypeShape<TDictionary, TKey, TValue> dictionaryShape, object? state = null) where TKey : notnull
Parameters
dictionaryShape
IDictionaryTypeShape<TDictionary, TKey, TValue>The dictionary shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
TDictionary
The type of the visited dictionary.
TKey
The key type of the visited dictionary.
TValue
The value type of the visited dictionary.
VisitEnum<TEnum, TUnderlying>(IEnumTypeShape<TEnum, TUnderlying>, object?)
Visits an IEnumTypeShape<TEnum, TUnderlying> instance.
object? VisitEnum<TEnum, TUnderlying>(IEnumTypeShape<TEnum, TUnderlying> enumShape, object? state = null) where TEnum : struct, Enum
Parameters
enumShape
IEnumTypeShape<TEnum, TUnderlying>The enum shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
TEnum
The type of visited enum.
TUnderlying
The underlying type used by the enum.
VisitEnumerable<TEnumerable, TElement>(IEnumerableTypeShape<TEnumerable, TElement>, object?)
Visits an IEnumerableTypeShape<TEnumerable, TElement> instance representing an enumerable type.
object? VisitEnumerable<TEnumerable, TElement>(IEnumerableTypeShape<TEnumerable, TElement> enumerableShape, object? state = null)
Parameters
enumerableShape
IEnumerableTypeShape<TEnumerable, TElement>The enumerable shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
TEnumerable
The type of the visited enumerable.
TElement
The element type of the visited enumerable.
VisitNullable<T>(INullableTypeShape<T>, object?)
Visits an INullableTypeShape<T> instance representing the Nullable<T> type.
object? VisitNullable<T>(INullableTypeShape<T> nullableShape, object? state = null) where T : struct
Parameters
nullableShape
INullableTypeShape<T>The nullable shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
T
The element type of the visited nullable.
VisitObject<T>(IObjectTypeShape<T>, object?)
Visits an IObjectTypeShape<T> representing a simple type or object.
object? VisitObject<T>(IObjectTypeShape<T> objectShape, object? state = null)
Parameters
objectShape
IObjectTypeShape<T>The type shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
T
The object type represented by the shape instance.
VisitProperty<TDeclaringType, TPropertyType>(IPropertyShape<TDeclaringType, TPropertyType>, object?)
Visits an IPropertyShape<TDeclaringType, TPropertyType> instance.
object? VisitProperty<TDeclaringType, TPropertyType>(IPropertyShape<TDeclaringType, TPropertyType> propertyShape, object? state = null)
Parameters
propertyShape
IPropertyShape<TDeclaringType, TPropertyType>The property shape to visit.
state
objectDefines user-provided state.
Returns
- object
The result produced by the visitor.
Type Parameters
TDeclaringType
The declaring type of the visited property.
TPropertyType
The property type of the visited property.