Class StringFlagsEnumConverter
- Assembly
- Cuemon.Extensions.Text.Json.dll
Converter to convert enums with FlagsAttribute to and from strings.
public class StringFlagsEnumConverter : JsonConverterFactory
- Inheritance
-
StringFlagsEnumConverter
- Inherited Members
- Extension Methods
Constructors
StringFlagsEnumConverter()
Initializes a new instance of the StringFlagsEnumConverter class.
public StringFlagsEnumConverter()
Methods
CanConvert(Type)
Determines whether the type can be converted.
public override bool CanConvert(Type typeToConvert)
Parameters
typeToConvert
TypeThe type is checked as to whether it can be converted.
Returns
- Boolean
true
if the type can be converted,false
otherwise.
CreateConverter(Type, JsonSerializerOptions)
Creates a converter for a specified typeToConvert
.
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
Parameters
typeToConvert
TypeThe Type being converted.
options
JsonSerializerOptionsThe JsonSerializerOptions being used.
Returns
- JsonConverter
An instance of a JsonConverter<T> where T is compatible with
typeToConvert
. If null is returned, a NotSupportedException will be thrown.