Läs på engelska Redigera

Dela via


JsonStringEnumConverter Class

Definition

Converts enumeration values to and from strings.

C#
public class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
C#
public sealed class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
Inheritance
JsonStringEnumConverter

Remarks

Reading is case insensitive. Writing can be customized by using a JsonNamingPolicy.

For more information, see How to customize property names and values with System.Text.Json.

Constructors

JsonStringEnumConverter()

Initializes an instance of the JsonStringEnumConverter class with the default naming policy that allows integer values.

JsonStringEnumConverter(JsonNamingPolicy, Boolean)

Initializes an instance of the JsonStringEnumConverter class with a specified naming policy and a value that indicates whether undefined enumeration values are allowed.

Properties

Type

Gets the type being converted by the current converter instance.

(Inherited from JsonConverterFactory)

Methods

CanConvert(Type)

Determines whether the specified type can be converted to an enum.

CreateConverter(Type, JsonSerializerOptions)

Creates a converter for the specified type.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

Produkt Versioner
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)