YamlStringEnumConverter class

Converter to convert enums to and from strings.

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

public class YamlStringEnumConverter : YamlConverterFactory

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

Converter to convert enums to and from strings.

RemarksLink to this heading

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

ConstructorsLink to this heading

Constructor. Creates the YamlStringEnumConverter with the default naming policy and allows integer values.

public YamlStringEnumConverter();

Constructor.

public YamlStringEnumConverter(YamlNamingPolicy? namingPolicy = null, bool allowIntegerValues = true);

Parameters

  • namingPolicy: Optional naming policy for writing enum values.
  • allowIntegerValues: True to allow undefined enum values. When true, if an enum value isn't defined it will output as a number rather than a string.

MethodsLink to this heading

CanConvertLink to this heading

Determines whether the type can be converted.

public sealed 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 sealed 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