Class IpRangeConverter
Converts a range to and from its text form, such as 10.0.0.1-10.0.0.9.
public class IpRangeConverter : JsonConverter<IpRange>
- Inheritance
-
IpRangeConverter
- Inherited Members
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type IpRange.
public override IpRange Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- IpRange
The converted value.
Exceptions
- FormatException
The value is not a range.
- InvalidOperationException
The reader's token is neither a string, a property name, nor a null; or the range's ends are of different families or in the wrong order.
Write(Utf8JsonWriter, IpRange, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, IpRange value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueIpRangeThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.