Table of Contents

Class VersionJson

Namespace
PolyMod.Json
Assembly
PolyMod.dll

The JSON converter that reads and writes a Version. The JSON form is a version string, for example "1.2.3".

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

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads a JSON string and makes a Version from it. The Version constructor throws an exception if the string is null or is not a valid version.

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

Parameters

reader Utf8JsonReader

The JSON reader, at a string token.

typeToConvert Type

The type to read. The method does not use it.

options JsonSerializerOptions

The serializer options. The method does not use them.

Returns

Version

The version from the JSON string.

Write(Utf8JsonWriter, Version, JsonSerializerOptions)

Writes a Version as a JSON string, for example "1.2.3".

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

Parameters

writer Utf8JsonWriter

The JSON writer.

value Version

The version to write.

options JsonSerializerOptions

The serializer options. The method does not use them.