An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword. C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.
using System; namespace Forum { public class Enum { enum Month { January, February, March, April, May, June, July, August, September, October, November, December }; static void Main(string[] args) { Month value = Month.January; if (value == Month.January) { Console.WriteLine("This Month is January."); } Console.ReadLine(); } }
}
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword.
C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.