Table of Contents

Class EndPointStrategyConverter

Namespace
VpnHood.AppLib.Api.Settings
Assembly
VpnHood.AppLib.Api.dll

Converts an EndPointStrategy to and from JSON: it writes the number, and reads a number or a name.

public sealed class EndPointStrategyConverter : JsonConverter<EndPointStrategy>
Inheritance
EndPointStrategyConverter
Inherited Members

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type EndPointStrategy.

public override EndPointStrategy 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

EndPointStrategy

The converted value.

Remarks

A number reads as it is; a name this version does not know fails.

Exceptions

FormatException

The number is not a whole number that fits in an int.

JsonException

The token is a name this version does not know, or neither a number nor a string.

Write(Utf8JsonWriter, EndPointStrategy, JsonSerializerOptions)

Writes a specified value as JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value EndPointStrategy

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.