Collection Generator
Specification
The Collection Generator component targets the .Net Framework version 2.0 and
requires, at least, this version to operate successfully. The Visual Studio add-in
used to display the wizard can be used with Visual Studio 2005 and Visual Studio 2008.
Overview
The Collection Generator component creates .Net
source code for a type-safe collection class. A type-safe collection only allows
objects of a specific type to be added to or inserted into it, all of the collection
members that deal with the collected items are of the type of the collected class
rather than Object. With a type-safe collection, calling code does
not have to constantly cast the items returned from collection members to the relevant
type. Any attempt by calling code to add an object of the wrong type to the collection
will be spotted at design time, as the code will not compile. Even when using late
bound objects, any attempt to add an object of the wrong type to the collection
at run-time will result in an exception.
Access to the Collection Generator component is provided by a wizard
that is used to capture the relevant generator properties. The wizard has two client
modes, it can be displayed by the Visual Studio 2005/2008 add-in provided
by Blayd Software or it can be displayed by the Blayd Software standalone client.
The standalone client is provided for users who do not have Visual Studio 2005
or Visual Studio 2008 installed on their machine, it does not have a dependency on any of the extensibility
interfaces required by an add-in. The add-in and the standalone clients are both
included in the installer package and you can choose to install either the add-in
or the standalone client or both.
.Net Language Support
The Collection Generator can generate source code for any .Net
language for which there is a code provider. A code provider is a class that derives
from the framework's System.CodeDom.Compiler.CodeDomProvider class.
There is direct (explicit) support for C# and Visual Basic
and there is a language category of "Other" to accommodate other .Net
languages. When selecting "Other" you also have to specify the fully qualified name
of the required code provider class. The chosen language must support collection
class types, so, for example, it must support indexers (Item property).
Features
The Collection Generator generates source code for a collection
class as follows:
- Basic type safe CollectionBase derived collection with a specified
type name that only allows objects of the specified collected class type to be added
to or inserted into it. The collection may be created in a specified namespace or
in the default namespace. If the collected class is not in the same namespace as
the collection, a namespace imports statement can be added to the collection class.
- Basic type safe CollectionBase derived collection with a specified
type name that only allows null reference entries and objects of the specified collected
class type to be added to or inserted into it. The collection may be created in
a specified namespace or in the default namespace. If the collected class is not
in the same namespace as the collection, a namespace imports statement can be added
to the collection class.
- Type safe NameObjectCollectionBase derived collection with a specified
type name that only allows named instances of the specified collected class type
to be added to it. The collection may be created in a specified namespace or in
the default namespace. If the collected class is not in the same namespace as the
collection, a namespace imports statement can be added to the collection class.
- Variants of a type safe NameObjectCollectionBase derived collection
including any combination of the following; null entries, duplicate names, empty
names and null names.
- A type safe collection that has a Synchronized method and a nested
thread-safe wrapper class that provides synchronized access to the collection.
- A type safe collection that has documentation comments assigned to the collection
class and all of its protected and public members. A documentation comment line
prefix may be specified to accommodate third-party documenters for .Net
languages that do not have built-in support for documentation comments.
- Various other combinations of the options outlined above...