Class CustomDateTimeConverterUtil
Inherited Members
Namespace: EasySave_Project.Util
Assembly: .dll
Syntax
public class CustomDateTimeConverterUtil : JsonConverter<DateTime>
Methods
| Edit this page View SourceRead(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts a JSON string to a DateTime object.
Declaration
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
Type | Name | Description |
---|---|---|
Utf8JsonReader | reader | The Utf8JsonReader to read from. |
Type | typeToConvert | The target type (should be DateTime). |
JsonSerializerOptions | options | Serialization options. |
Returns
Type | Description |
---|---|
DateTime | The parsed DateTime object. |
Overrides
Exceptions
Type | Condition |
---|---|
JsonException | Thrown if parsing fails. |
Write(Utf8JsonWriter, DateTime, JsonSerializerOptions)
Writes a DateTime object as a JSON string using the specified format.
Declaration
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
Parameters
Type | Name | Description |
---|---|---|
Utf8JsonWriter | writer | The Utf8JsonWriter to write to. |
DateTime | value | The DateTime value to serialize. |
JsonSerializerOptions | options | Serialization options. |