Table of Contents

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

ITypeShapeProvider

Methods

GetConverter(ITypeShape)

Gets a converter for an untyped shape.

public JsonConverter GetConverter(ITypeShape shape)

Parameters

shape ITypeShape

The 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

type Type

The type to convert.

provider ITypeShapeProvider

The 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

T

The type to convert.

GetConverter<T>(ITypeShapeProvider?)

Gets a converter using an explicitly supplied or contextual provider.

public JsonConverter<T> GetConverter<T>(ITypeShapeProvider? provider)

Parameters

provider ITypeShapeProvider

The provider, or null to use TypeShapeProvider.

Returns

JsonConverter<T>

The converter.

Type Parameters

T

The type to convert.

GetConverter<T>(ITypeShape<T>)

Gets a converter for a specific type shape.

public JsonConverter<T> GetConverter<T>(ITypeShape<T> shape)

Parameters

shape ITypeShape<T>

The type shape.

Returns

JsonConverter<T>

The converter.

Type Parameters

T

The 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

T

The type to convert.

TProvider

The witness type that provides the shape for T.