Home EnumStringConverter Class
EnumStringConverter Class
Cancel

EnumStringConverter Class

Namespace: Json.More

Inheritance: EnumStringConverter<T> 🡒 WeaklyTypedJsonConverter<T> 🡒 JsonConverter<T> 🡒 JsonConverter 🡒 object

Implemented interfaces:

  • IWeaklyTypedJsonConverter

Properties

NameTypeSummary
HandleNullbool 
TypeType 

Methods

Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads and converts the JSON to type .

Declaration

1
public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
ParameterTypeDescription
readerref Utf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.

Returns

The converted value.

ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads a dictionary key from a JSON property name.

Declaration

1
public override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
ParameterTypeDescription
readerref Utf8JsonReaderThe System.Text.Json.Utf8JsonReader to read from.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsThe options to use when reading the value.

Returns

The value that was converted.

Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)

Writes a specified value as JSON.

Declaration

1
public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
ParameterTypeDescription
writerUtf8JsonWriterThe writer to write to.
valueTThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.

WriteAsPropertyName(Utf8JsonWriter writer, T value, JsonSerializerOptions options)

Writes a dictionary key as a JSON property name.

Declaration

1
public override void WriteAsPropertyName(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
ParameterTypeDescription
writerUtf8JsonWriterThe System.Text.Json.Utf8JsonWriter to write to.
valueTThe value to convert. The value of System.Text.Json.Serialization.JsonConverter`1.HandleNull determines if the converter handles <see langword=”null” /> values.
optionsJsonSerializerOptionsThe options to use when writing the value.
Contents