Table of Contents

Class VersionConverter

Namespace
VpnHood.Net.Toolkit.Converters
Assembly
VpnHood.Net.Toolkit.dll

Converts a Version to and from its text form, such as 1.2.3.4.

public class VersionConverter : JsonConverter<Version>
Inheritance
VersionConverter
Inherited Members

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type Version.

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

Parameters

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

Version

The converted value.

Exceptions

ArgumentException

The text has fewer than two or more than four parts.

ArgumentOutOfRangeException

A part is negative.

FormatException

A part is not a number.

OverflowException

A part is too large.

InvalidOperationException

The value is not a string.

Write(Utf8JsonWriter, Version, JsonSerializerOptions)

Writes a specified value as JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value Version

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.