using System;
using System.ComponentModel;
namespace FirstApplication
{
public enum TestEnum
None,
[Description("Value 1")]
Value1,
[Description("Value 2")]
Value2,
};
class Program
static void Main(string[] args)
TestEnum castUnspecifiedValue = (TestEnum)42;
// this exception gets wrapped.
string enumName = Enum.GetName(castUnspecifiedValue) ?? throw new Exception();
}