Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

JsonStringEnumConverter<TEnum> Class

Definition

Namespace:
System.Text.Json.Serialization
Assembly:
System.Text.Json.dll
Package:
System.Text.Json v11.0.0-preview.5.26302.115
Source:
JsonStringEnumConverter.cs
Source:
JsonStringEnumConverter.cs
Source:
JsonStringEnumConverter.cs
Source:
JsonStringEnumConverter.cs
Source:
JsonStringEnumConverter.cs
Source:
JsonStringEnumConverter.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Converter to convert enums to and from strings.

generic <typename TEnum>
 where TEnum : value classpublic ref class JsonStringEnumConverter : System::Text::Json::Serialization::JsonConverterFactory
public class JsonStringEnumConverter<TEnum> : System.Text.Json.Serialization.JsonConverterFactory where TEnum : struct
type JsonStringEnumConverter<'Enum (requires 'Enum : struct)> = class
 inherit JsonConverterFactory
Public Class JsonStringEnumConverter(Of TEnum)
Inherits JsonConverterFactory

Type Parameters

TEnum

The enum type that this converter targets.

Inheritance
JsonStringEnumConverter<TEnum>

Remarks

Reading is case insensitive, and writing can be customized via a JsonNamingPolicy.

Constructors

Name Description
JsonStringEnumConverter<TEnum>()

Initializes a new instance of JsonStringEnumConverter<TEnum> with the default naming policy and that allows integer values.

JsonStringEnumConverter<TEnum>(JsonNamingPolicy, Boolean)

Initializes a new instance of JsonStringEnumConverter<TEnum>.

Properties

Name Description
Type

Gets the type being converted by the current converter instance.

(Inherited from JsonConverterFactory)

Methods

Name Description
CanConvert(Type)

When overridden in a derived class, determines whether the converter instance can convert the specified object type.

CreateConverter(Type, JsonSerializerOptions)

Creates a converter for a 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


Feedback

Was this page helpful?