C# FAQ: What is the difference between CSharp and Java enumerations
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
[edit]
What is the difference between C# and Java enumerations (enum)?
Enumerations—enums—are employed to create a list of named constants defined by the developer. At first glance, the Java and C# enumerated types appear similar; but, there are significant differences between the two implementations. A C# enumerated type is a compiler trick based on an integral type—normally int—; therefore, it is neither typesafe nor extensible. On the other hand, a Java enumerated type is an actual class; thus, it is typesafe and is extendable by adding fields, interfaces, or methods.
[edit]