Struct ConverterContext
- Namespace
- Nerdbank.Json
- Assembly
- Nerdbank.Json.dll
Provides converter lookup services while a IJsonConverterFactory is creating a converter.
public readonly struct ConverterContext
- Inherited Members
Properties
TypeShapeProvider
Gets the provider used to discover shapes for nested values.
public ITypeShapeProvider TypeShapeProvider { get; }
Property Value
Methods
GetConverter(ITypeShape)
Gets a converter for an untyped shape.
public JsonConverter GetConverter(ITypeShape shape)
Parameters
shapeITypeShapeThe type shape.
Returns
- JsonConverter
The converter.
GetConverter(Type, ITypeShapeProvider?)
Gets a converter for a runtime type.
public JsonConverter GetConverter(Type type, ITypeShapeProvider? provider = null)
Parameters
typeTypeThe type to convert.
providerITypeShapeProviderThe provider, or null to use TypeShapeProvider.
Returns
- JsonConverter
The converter.
GetConverter<T>()
Gets a converter for a specific type.
public JsonConverter<T> GetConverter<T>() where T : IShapeable<T>
Returns
- JsonConverter<T>
The converter.
Type Parameters
TThe type to convert.
GetConverter<T>(ITypeShapeProvider?)
Gets a converter using an explicitly supplied or contextual provider.
public JsonConverter<T> GetConverter<T>(ITypeShapeProvider? provider)
Parameters
providerITypeShapeProviderThe provider, or null to use TypeShapeProvider.
Returns
- JsonConverter<T>
The converter.
Type Parameters
TThe type to convert.
GetConverter<T>(ITypeShape<T>)
Gets a converter for a specific type shape.
public JsonConverter<T> GetConverter<T>(ITypeShape<T> shape)
Parameters
shapeITypeShape<T>The type shape.
Returns
- JsonConverter<T>
The converter.
Type Parameters
TThe type to convert.
GetConverter<T, TProvider>()
Gets a converter for a specific type.
public JsonConverter<T> GetConverter<T, TProvider>() where TProvider : IShapeable<T>
Returns
- JsonConverter<T>
The converter.
Type Parameters
TThe type to convert.
TProviderThe witness type that provides the shape for
T.