TomlStringEnumConverter Class
Converts enum values to and from their names, instead of their numeric values.
public sealed class TomlStringEnumConverter : TomlConverterRemarks
Apply it with TomlConverterAttribute to an enum type or to a member, or add it to TomlSerializerOptions.Converters to write every enum as a string. TomlStringEnumMemberNameAttribute sets the name of an enum value. A flags value is written as a comma-separated list of names.
Names are read case-insensitively, an exact match first, and integers are read as numeric values. The C# name of a value renamed with TomlStringEnumMemberNameAttribute is read too.
- Inheritance
TomlConverterTomlStringEnumConverter
Constructors
| Name | Description |
|---|---|
| TomlStringEnumConverter() |
TomlStringEnumConverter()
public TomlStringEnumConverter()No documentation is available.
Methods
| Name | Description |
|---|---|
| CanConvert(Type) | Determines whether this converter can handle typeToConvert. |
| Read(TomlReader, Type) | Reads a value from TOML. |
| Write(TomlWriter, object?) | Writes a value to TOML. |
CanConvert(Type)
TomlStringEnumConverter.csRead(TomlReader, Type)
TomlStringEnumConverter.csReads a value from TOML.
public override object? Read(TomlReader reader, Type typeToConvert)Write(TomlWriter, object?)
TomlStringEnumConverter.csWrites a value to TOML.
public override void Write(TomlWriter writer, object? value)Parameters
writerTomlWritervalueobject?