Class TimeSpanConverter
- Namespace
- Tudormobile.Strava.Converters
- Assembly
- Tudormobile.Strava.dll
Converts a TimeSpan to and from its JSON representation as the total number of seconds.
public class TimeSpanConverter : JsonConverter<TimeSpan>
- Inheritance
-
TimeSpanConverter
- Inherited Members
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads a TimeSpan value from the JSON input as the total number of seconds.
public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe Utf8JsonReader to read from.
typeToConvertTypeThe type to convert (should be TimeSpan).
optionsJsonSerializerOptionsOptions to control the conversion behavior.
Returns
Write(Utf8JsonWriter, TimeSpan, JsonSerializerOptions)
Writes a TimeSpan value as the total number of seconds to the JSON output.
public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe Utf8JsonWriter to write to.
valueTimeSpanThe TimeSpan value to convert.
optionsJsonSerializerOptionsOptions to control the conversion behavior.