Test Design StudioGo to Previous Topic: Formatting ListsGo to Next Topic: Defining Keys for VBScript Dictionary Object

Define an Enum List

Certain Enum lists are built-in for a language, but this XML tag allows you to create your own enum. This tag is used within file-level comments. See XML Comments for the rules governing the placement and use of file-level comments.

You specify an enum using the 'enum' tag. The 'name' attribute of that tag defines a unique name for the enum. The 'type' attribute can optionally be used to define the type of all values in the enum. The following sample illustrates the use of the 'enum' tag.

[VBScript] - Copy Code
''' <enum name="binary" type="Integer">
''' <summary>Defines possible binary values</summary>
''' <item>0</item>
''' <item>1</item>
''' </enum>
[JScript] - Copy Code
/// <enum name="binary" type="int">
/// <summary>Defines possible binary values</summary>
/// <item>0</item>
/// <item>1</item>
/// </enum>

The 'enum' tag supports two nested tags:
TagDescription
summaryProvides basic information about the enum.
itemDefines the individual items that will be members of the enum. See below for details on how to populate this tag.

Populating the 'item' Tag

There are three methods for populating the item tag:

Inner Text Method

You can directly enter the text of the enum item using the inner text of the 'item' tag. This method is illustrated in the 'enum' sample above.

Sub-Tag Method

You can nest the 'text' and 'description' tags within the 'item' tag to define the enum item as well as a description for that item. The description will appear in the Object Browser, IntelliSense, and Documentation.

[VBScript] - Copy Code
''' <enum name="binary" type="Integer">
''' <summary>Defines possible binary values</summary>
''' <item><text>0</text><description>Binary value 0</description></item>
''' <item><text>1</text><description>Binary value 1</description></item>
''' </enum>
[JScript] - Copy Code
/// <enum name="binary" type="int">
/// <summary>Defines possible binary values</summary>
/// <item><text>0</text><description>Binary value 0</description></item>
/// <item><text>1</text><description>Binary value 1</description></item>
/// </enum>

Cross-Reference Method

You can use the 'cref' attribute of the 'item' tag to indicate a reference to a defined constant. The details of the referenced constant will be used to describe the return value. Inner text is not used with this method.

[VBScript] - Copy Code
''' <enum name="binary" type="Integer">
''' <summary>Defines possible binary values</summary>
''' <item cref="Binary0"/>
''' <item cref="Binary1"/>
''' </enum>



''' <summary>Binary value 0</summary>
Const Binary0 = 0;
''' <summary>Binary value 1</summary>
Const Binary1 = 1;
Warning:   As illustrated in the sample above, make sure you have three blank lines after the file-level comments to avoid comments being mistakenly applied to other items in the file.