Enums in C#
Our enum type ServerState
has an underlying int
type.
The possible values for ServerState
are defined as constants. In C#, enum values are automatically assigned successive integer values starting from 0.
By implementing the ToString
method, values of ServerState
can be printed out or converted to strings.
To run the program, compile the code with csc
(C# Compiler) and run the executable.