Table of Contents

Class TimeSpanConverter2

Namespace
Geotab.Serialization
Assembly
Geotab.Checkmate.ObjectModel.dll

A class that contains the logic to convert an object to JSON.

public class TimeSpanConverter2 : BaseJsonConverter2<TimeSpan>
Inheritance
TimeSpanConverter2
Inherited Members

Constructors

TimeSpanConverter2()

public TimeSpanConverter2()

Methods

CanConvert(Type)

public override bool CanConvert(Type typeToConvert)

Parameters

typeToConvert Type

Returns

bool

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Read and convert the JSON to T.

public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The Utf8JsonReader to read from.

typeToConvert Type

The Type being converted.

options JsonSerializerOptions

The JsonSerializerOptions being used.

Returns

TimeSpan

The value that was converted.

Remarks

A converter may throw any Exception, but should throw JsonException when the JSON is invalid.

Write(Utf8JsonWriter, TimeSpan, JsonSerializerOptions)

Write the value as JSON.

public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

The Utf8JsonWriter to write to.

value TimeSpan

The value to convert.

options JsonSerializerOptions

The JsonSerializerOptions being used.

Remarks

A converter may throw any Exception, but should throw JsonException when the JSON cannot be created.