spacer
Yehuda Shiran May 11, 2002
Outside-the-Range Enum Values
Tips: May 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
An enumerated variable can assume values outside the range of its declared values. This is convenient if you want to combine two values to create a third one which is not defined as a member. Let's assume we have the following enumeration:

  enum tvNetworkType {
      ABC,
      CBS,
      NBC,
      FOX
    }
The following line demonstrates a combination of the members NBC and FOX:

  var tvCombination : tvNetworkType = tvNetworkType.NBC | tvNetworkType.FOX;
If you print the value of tvCombination above, you would get the value of 12 (the OR combination of 8 and 4).

To learn more about 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:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering MySQL Databases on the Web Using PHP · Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
So what is an Oracle Nested Table? · E-Discovery Architectures 101 · eBay Embraces Big Sellers, Cyber Monday Trends