The FileHelpers are a free and easy to use .NET library to read/write data from fixed length or delimited records in files, strings or streams
1.13k
stars
349
forks
source link
Extend EnumConverter to use EnumMemberAttribute #417
Open
jkonecki opened 2 years ago
EnumConverter
is internally usingEnum.Parse
method that assumes that the parsed value matches the name of the enum value.System.Runtime.Serialization
has anEnumMemberAttribute
(https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.enummemberattribute) that can be used to decorate each field and specify a different value:This allows for easy definition of mapings between 'proper' names of enum options and the actual string values that will be serialized.
I would like to extend
EnumConverter
to utilize theEnumMemberAttribute
during conversion.Please let me know if you would be interested in my PR for this change.