c# get name of enum code example
Example 1: get enum name from value c#
int enumValue = 2; // The value for which you want to get string
string enumName = Enum.GetName(typeof(EnumDisplayStatus), enumValue);
Example 2: get key from c# enum for specific value
enum myEnum { firstValue: 1, secondValue 2, thirdValue = 3};
string text = Enum.GetName(typeof(myEnum), 2); // text is "secondValue"