Class EndPointStrategyConverter
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
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn 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
writerUtf8JsonWriterThe writer to write to.
valueEndPointStrategyThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.