Class DateOnlyConverter
- Namespace
- Auth0.ManagementApi.Core
- Assembly
- Auth0.ManagementApi.dll
Custom converter for handling the System.DateOnly data type with the System.Text.Json library.
public sealed class DateOnlyConverter : JsonConverter<DateOnly>
- Inheritance
-
JsonConverter<DateOnly>DateOnlyConverter
- Inherited Members
- Extension Methods
Remarks
This class backported from: System.Text.Json.Serialization.Converters.DateOnlyConverter
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type System.DateOnly.
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- DateOnly
The converted value.
ReadAsPropertyName(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads a dictionary key from a JSON property name.
public override DateOnly ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe Utf8JsonReader to read from.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsThe options to use when reading the value.
Returns
- DateOnly
The value that was converted.
Write(Utf8JsonWriter, DateOnly, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueDateOnlyThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
WriteAsPropertyName(Utf8JsonWriter, DateOnly, JsonSerializerOptions)
Writes a dictionary key as a JSON property name.
public override void WriteAsPropertyName(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe Utf8JsonWriter to write to.
valueDateOnlyThe value to convert. The value of HandleNull determines if the converter handles null values.
optionsJsonSerializerOptionsThe options to use when writing the value.