Class IpNetworkConverter
Converts a network to and from its text form, such as 10.0.0.0/8.
public class IpNetworkConverter : JsonConverter<IpNetwork>
- Inheritance
-
IpNetworkConverter
- Inherited Members
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type IpNetwork.
public override IpNetwork Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- IpNetwork
The converted value.
Exceptions
- FormatException
The value is not a network.
- InvalidOperationException
The reader's token is neither a string, a property name, nor a null.
Write(Utf8JsonWriter, IpNetwork, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, IpNetwork value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueIpNetworkThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.