Class OptionalConverterFactory
Represents JSON converter for Optional<T> data type.
Inherited Members
Namespace: DotNext.Text.Json
Assembly: DotNext.dll
Syntax
public sealed class OptionalConverterFactory : JsonConverterFactory
Remarks
For AOT and self-contained app deployment models, use OptionalConverter<T> converter explicitly as an argument for JsonConverterAttribute.
Methods
| Edit this page View SourceCanConvert(Type)
When overridden in a derived class, determines whether the converter instance can convert the specified object type.
Declaration
public override bool CanConvert(Type typeToConvert)
Parameters
Type | Name | Description |
---|---|---|
Type | typeToConvert | The type of the object to check whether it can be converted by this converter instance. |
Returns
Type | Description |
---|---|
bool | true if the instance can convert the specified object type; otherwise, false. |
Overrides
| Edit this page View SourceCreateConverter(Type, JsonSerializerOptions)
Creates a converter for a specified type.
Declaration
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
Parameters
Type | Name | Description |
---|---|---|
Type | typeToConvert | The type handled by the converter. |
JsonSerializerOptions | options | The serialization options to use. |
Returns
Type | Description |
---|---|
JsonConverter | A converter for which |