This post will discuss how to get the enum member name from the associated constant value in C#.

1. Using Enum.GetName() method

The standard method to retrieve the name of the constant having the specified value is to use the Enum.GetName() method. This is demonstrated below:

Download  Run Code

2. Using Casting

To get the corresponding constant value from an enumeration member, use casting. The following example demonstrates its usage.

Download  Run Code

That’s all about getting an enum name from a value in C#.