Introduction to C#
- slide 8 : 43
Enumerations types
Enumeration types are similar to each other in C and C#
public enum Ranking {Bad, OK, Good} public enum OnOff: byte{ On = 1, Off = 0}
An extension of C enumeration types:
Enumeration types of several different
underlying types
can be defined (not just
int
)
Enumeration types inherit a number of methods from the type
System.Enum
The symbolic enumeration constants can be printed (not just the underlying number)
Values, for which no enumeration constant exist, can be dealt with
Combined enumerations represent a collection of enumerations
Demonstration of enumeration types in C#.
Output from the program that demonstrates enumeration types.
ECTS Grades
Use of Enumeration types