spacer
Yehuda Shiran May 10, 2002
Setting the Enum Values
Tips: May 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

An enum value in JScript .NET is accessed as an object member. The name of the member should be prefixed by the name of the enumeration, for example tvNetworkType.ABC. When you assign a value to an enumerated variable, you can use a full name (such as tvNetworkType.ABC), a string representation of the name ("ABC"), or a numeric value (1).

When you use a string that is known at compile time, the compiler will perform the necessary conversion. For example, "ABC" would be replaced by tvNetworkType.ABC. If the string is not known at compile time, a conversion will be made at run time. That conversion may fail if the string is not a valid member of the enumerated type. It's a good practice to avoid run-time assignments of enumerated variables. It takes precious CPU time, and it may end up in an error.

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:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business