Enum.GetName(Type, Object) Method is used to get the name of the constant in the specified enumeration that has the specified value.
public static string GetName (Type enumType, object value);
- enumType: It is an enumeration type.
- value: It is the value of a particular enumerated constant in terms of its underlying type.
Returns: It is a string containing the name of the enumerated constant in enumType whose value is the value or null if no such constant is found.
- ArgumentNullException: If the enumType or value is null.
- ArgumentException: If the enumType is not an Enum or value is neither of type enumType nor does it have the same underlying type as enumType.
2nd value is Cat 4th value is Monkey
- C# | Enumeration (or enum)
- Different Types of HTML Helpers in ASP.NET MVC
- Difference Between .NET and ASP.NET Framework
- Difference Between Properties and Indexers in C#
- C# Coding Standards
- C# Program to Convert a Binary String to an Integer
- Basics of FileStream in C#
- C# Program for Nested Conditional Operator
- C# Program for Converting Hexadecimal String to Integer
- Program to Input Weekday Number and Print the Weekday in C#
- What is NuGet?
- Top 10 Programming Languages for Blockchain Development
- C# Program to Convert the Octal String to an Integer Number
- int Keyword in C#
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.