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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint