Class IPEndPointConverter
- Namespace
- VpnHood.Net.Toolkit.Converters
- Assembly
- VpnHood.Net.Toolkit.dll
Converts an IPEndPoint to and from its text form, such as 192.168.0.1:443 or
[::1]:443.
public class IPEndPointConverter : JsonConverter<IPEndPoint>
- Inheritance
-
IPEndPointConverter
- Inherited Members
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type IPEndPoint.
public override IPEndPoint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- IPEndPoint
The converted value.
Exceptions
- FormatException
The value is null or not an endpoint.
- InvalidOperationException
The value is not a string.
Write(Utf8JsonWriter, IPEndPoint, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, IPEndPoint value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueIPEndPointThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.