May 7, 2002 - Defining and Using Enumeration
May 7, 2002 Defining and Using Enumeration Tips: May 2002
Yehuda Shiran, Ph.D.
|
enum
statement. The following enum
statement enumerates the major TV networks in the US:
enum tvNetworkType {
ABC,
CBS,
NBC,
FOX
}
When you define a variable of type tvNetworkType
, it can assume only one of the four values above: ABC
, CBS
, NBC
, and FOX
. Let's declare such a variable:
var myFavoriteStation : tvNetworkType;
Let's assign it now the value of ABC
:
myFavoriteStation = tvNetworkType.ABC;
To learn more on JScript .NET, go to Column 108, JScript .NET, Part II: Major Features.