Class VersionJson
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
readerUtf8JsonReaderThe JSON reader, at a string token.
typeToConvertTypeThe type to read. The method does not use it.
optionsJsonSerializerOptionsThe 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
writerUtf8JsonWriterThe JSON writer.
valueVersionThe version to write.
optionsJsonSerializerOptionsThe serializer options. The method does not use them.