JsonStringEnumConverter Class
Definition
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.
Converts enumeration values to and from strings.
public ref class JsonStringEnumConverter : System::Text::Json::Serialization::JsonConverterFactory
public ref class JsonStringEnumConverter sealed : System::Text::Json::Serialization::JsonConverterFactory
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JsonStringEnumConverter cannot be statically analyzed and requires runtime code generation. Applications should use the generic JsonStringEnumConverter<TEnum> instead.")]
public class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
public sealed class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
public class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JsonStringEnumConverter cannot be statically analyzed and requires runtime code generation. Consider authoring a custom converter that is not a factory to work around the issue. See https://github.com/dotnet/runtime/issues/73124.")]
public class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JsonStringEnumConverter cannot be statically analyzed and requires runtime code generation. Applications should use the generic JsonStringEnumConverter<TEnum> instead.")>]
type JsonStringEnumConverter = class
inherit JsonConverterFactory
type JsonStringEnumConverter = class
inherit JsonConverterFactory
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JsonStringEnumConverter cannot be statically analyzed and requires runtime code generation. Consider authoring a custom converter that is not a factory to work around the issue. See https://github.com/dotnet/runtime/issues/73124.")>]
type JsonStringEnumConverter = class
inherit JsonConverterFactory
Public Class JsonStringEnumConverter
Inherits JsonConverterFactory
Public NotInheritable Class JsonStringEnumConverter
Inherits JsonConverterFactory
- Inheritance
- Attributes
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) |