StringCollection

Please take notice that this class has been marked as obsolete. Please use a generic collection instead.

The StringCollection provides a way for users to enter a list of strings. In your code, you can refer to these strings as members of an array. To use this class, you must include a reference to the CodeSmith.CustomProperties assembly in your template:

<%@ Assembly Name="CodeSmith.CustomProperties" %>

After you include the appropriate assembly reference, you can define a property in a script block that uses the StringCollection

<%@ Property Name="List" Type="CodeSmith.CustomProperties.StringCollection" Category="Custom" Description="This is the list." %>

When the user executes the template, the specified property will display a builder button on the property sheet:

Clicking the builder button will open an editor that allows the user to type strings on separate lines:

You can also edit the members of the collection directly in the property grid as a comma-separated list.

In your code, you can iterate through the collection as an array:

The list is:

<% for (int i = 0; i < List.Count; i++)\{ %>
<%= List[i] %>
<% \} %>