I am writing cscfg file. I want to present one of its values to be enum:
enum Importance
{
None,
Trivial,
Regular,
Important,
Critical
};
I cscfg file I have a following Setting:
<Setting name="MySettings" value="None">
- Is it a correct way to present enum in cscfg?
- How do I read this value to actual enum? And how do I validate if the value doesn`t match enum?
For example:
<Setting name="MySettings" value="Kuku">
You can use
Enum.TryParse
for this: