IntervalSetJsonConverterFactory Class
Definition
- Assembly
- Bodu.Numerics.Serialization.Json.dll
- Package
- Bodu.Numerics.Serialization.Json 1.0.0
Creates IntervalSetJsonConverter<T> instances for closed IntervalSet<T> types, applying a configurable NumericsJsonPolicy to every closed converter the factory produces.
public sealed class IntervalSetJsonConverterFactory : JsonConverterFactory
- Inheritance
-
IntervalSetJsonConverterFactory
- Inherited Members
- Extension Methods
Remarks
Register this factory through AddNumericsJsonConverters(JsonSerializerOptions, NumericsJsonPolicy); the
core IntervalSet<T> type carries no JsonConverterAttribute so that
Bodu.Numerics stays serialization-agnostic.
Constructors
IntervalSetJsonConverterFactory()
Initializes a new instance of the IntervalSetJsonConverterFactory class configured for the Strict shape.
public IntervalSetJsonConverterFactory()
IntervalSetJsonConverterFactory(NumericsJsonPolicy)
Initializes a new instance of the IntervalSetJsonConverterFactory class configured for the
supplied policy.
public IntervalSetJsonConverterFactory(NumericsJsonPolicy policy)
Parameters
policyNumericsJsonPolicyThe policy applied to every closed converter the factory produces.
Exceptions
- ArgumentOutOfRangeException
policyis not a defined NumericsJsonPolicy value.
Methods
CanConvert(Type)
Determines whether this factory can create a converter for the specified type.
public override bool CanConvert(Type typeToConvert)
Parameters
typeToConvertTypeThe candidate type.
Returns
- bool
true if
typeToConvertis a closed IntervalSet<T> type; otherwise, false.
CreateConverter(Type, JsonSerializerOptions)
Creates a converter for the specified closed IntervalSet<T> type.
[UnconditionalSuppressMessage("Aot", "IL3050", Justification = "Reached only through reflection-based JSON serialization, whose public entry points carry the RequiresDynamicCode annotation.")]
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
Parameters
typeToConvertTypeThe closed IntervalSet<T> type to convert.
optionsJsonSerializerOptionsThe serializer options in effect.
Returns
- JsonConverter
A converter for
typeToConvert.
Exceptions
- ArgumentNullException
Thrown when
typeToConvertis null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |