Declaring an Enumerated Property

Sometimes it's convenient to have a property that limits the user to selecting from a fixed set of choices. For instance, in the VBSortedList.cst template, the Accessibility property controls the accessibility of the generated class:

To accomplish this, you need to take two steps. First, define an enumeration in a <script> block in your code:

<script runat="template">
Public Enum AccessibilityEnum
      [Public]
      [Protected]
      [Friend]
      [ProtectedFriend]
      [Private]
End Enum
</script>

Second, the Property directive should point to the enumeration:

<%@ Property Name="Accessibility" Type="AccessibilityEnum" Category="Options" Description="The accessibility of the class to be generated." %>

That's all there is to it!