Be a Supporter!
Response to: C# or Java Posted July 5th, 2013 in Programming

Java and C# are similar programming languages that are statically, strongly, and manifestly typed, both are class-based object-oriented, both are designed with semi-interpretation or runtime compilation in mind, both use garbage-collection, and both are "curly brace languages" like C and C++.

Java
In Java, both the enumeration type and (optionally) the individual enumeration values are Java classes. The only valid values are the ones listed in the enumeration. The enumeration type may declare or override members (such as a dedicated toString() method) that will be inherited by the individual enumerated values, and it can be extended by adding methods, fields or even interfaces can be implemented for it. The individual enumerated values may in turn override members or even define new members only valid for that specific value.
C#
Enumerations in C# are implicitly derived from the Enum type that again is a value type derivative. The value set of a C# enumeration is defined by the underlying type that can be a signed or unsigned integer type of 8, 16, 32 or 64 bits. The enumeration definition defines names for the selected integer values and is syntactic sugar. By default the first name is assigned the value 0 (zero) and the following names are assigned in increments of 1. Any value of the underlying primitive type is a valid value of the enumeration type, though an explicit cast may be needed to assign it.
C# supports bit-mapped enumerations where an actual value may be a combination of enumerated values bitwise ordered together. The formatting and parsing methods implicitly defined by the type will attempt to use these values.