Table of Contents

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

reader Utf8JsonReader

The Utf8JsonReader to read from.

typeToConvert Type

The type to convert (should be TimeSpan).

options JsonSerializerOptions

Options to control the conversion behavior.

Returns

TimeSpan

The TimeSpan value represented by the number of seconds in the JSON.

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

writer Utf8JsonWriter

The Utf8JsonWriter to write to.

value TimeSpan

The TimeSpan value to convert.

options JsonSerializerOptions

Options to control the conversion behavior.