|
May 9, 2002 Defining the Enumeration's Discrete Values Tips: May 2002
Yehuda Shiran, Ph.D.
|
|
Symbolic names you declare within the enum statement are numbered sequentially, starting at zero. In the following example:
the enumerated values are:
By default, the first member is initialized as zero. You can change it by setting its value explicitly. For example, you can decide that ABC should be equal to 1 instead of zero:
You can initialize any member of the enumerated type. By default, each member is one more than the previous member, if not explicitly initialized. In the above example, CBS is 2, NBC is 3, and FOX is 4. You can initialize all of them as follows:
To learn more on JScript .NET, go to Column 108, JScript .NET, Part II: Major Features.
People who read this tip also read these tips: Look for similar tips by subject: |