The first example works:
if (Enum.TryParse<eNUM>("Four", out _num))
{
//do some thing
}
else
{
// invalid enum value
}
When calling this with Four
, you will get in the else
branch. When calling with Two
it works.
If you want to ignore the casing, you can set the second parameter of TryParse
to true
.