So we have our enums setup like this:
[CorrelatedNumeric(0)]
[Description("USD")]
[SequenceNumber(10)]
USD = 247
Basically, another function can provide the string “USD” to me, but not the exact enum because the source of it is Excel and we can’t make our users remember the enum values 😉 nor would that make much sense.
Is there a way in c# to get from “USD” to 247 from having our enums setup as they are above?
Would
Enum.TryParse()orEnum.Parse()do what you need?