Is there a way to get the value from the Enum Description? I have been searching but most cases are returning Description from a value. Is there a way to do this backwards, return the value from the description?
I.E Given "Bio Chem Physics" I want it to return FirstYearScience. So I can use it in another dictionary and reference it by bookType.FirstYearScience.
I am only given the description nothing else, or is there a better way to approach this problem? Thanks!
using System.ComponentModel;
public enum bookType
{
[EnumMember]
[Description("Non Fiction")]
NonFiction,
[EnumMember]
[Description("Fiction")]
Fiction,
[EnumMember]
[Description("Bio Chem Physics")]
FirstYearScience,
}