Class NodaTimeDefaultJsonConverterFactory
Provides JSON default converters for Noda Time types, as if using serializer
options configured by ConfigureForNodaTime(JsonSerializerOptions, IDateTimeZoneProvider)
with a provider of Tzdb.
Since 3.2.x
Availability net6.0, netstandard2.0
Inherited Members
Namespace: NodaTime.Serialization.SystemTextJson
Assembly: NodaTime.Serialization.SystemTextJson.dll
Syntax
public sealed class NodaTimeDefaultJsonConverterFactory : JsonConverterFactory
Remarks
This is a factory equivalent of NodaTimeDefaultJsonConverterAttribute.
Constructors
NodaTimeDefaultJsonConverterFactory()
Constructs an instance of the factory.
Since 3.2.x
Availability net6.0, netstandard2.0
Declaration
public NodaTimeDefaultJsonConverterFactory()
Methods
CanConvert(Type)
When overridden in a derived class, determines whether the converter instance can convert the specified object type.
Since 3.2.x
Availability net6.0, netstandard2.0
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
CreateConverter(Type, JsonSerializerOptions)
Creates a converter for a specified type.
Since 3.2.x
Availability net6.0, netstandard2.0
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 T is compatible with typeToConvert . |