YamlNumberEnumConverter<TEnum> class

Converter to convert enums to and from numeric values.

Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll

public sealed class YamlNumberEnumConverter<TEnum> : YamlConverterFactory
    where TEnum : struct, Enum

Inheritance: object โ†’ YamlConverter โ†’ YamlConverterFactory โ†’ YamlNumberEnumConverter

Converter to convert enums to and from numeric values.

Type parameters

  • TEnum: The enum type that this converter targets.

RemarksLink to this heading

This is the default converter for enums and can be used to override YamlSourceGenerationOptionsAttribute.UseStringEnumConverter on individual types or properties.

ConstructorsLink to this heading

Initializes a new instance of YamlNumberEnumConverter<TEnum>.

public YamlNumberEnumConverter();

MethodsLink to this heading

CanConvertLink to this heading

Determines whether the type can be converted.

public override bool CanConvert(Type typeToConvert);

Parameters

  • typeToConvert: The type is checked as to whether it can be converted.

Returns: True if the type can be converted, false otherwise.

CreateConverterLink to this heading

Create a converter for the provided Type.

public override YamlConverter? CreateConverter(Type typeToConvert, YamlSerializerOptions options);

Parameters

Returns: An instance of a YamlConverter<T> where T is compatible with typeToConvert. If null is returned, a NotSupportedException will be thrown.

Generated from the XML documentation of the libraryBuilt with Douze

Esc to close