The [ItemType] attribute is used to specify the type of collection elements. For Collection types that implement IDictionary, the [ItemType] attribute can be used to specify the type for both the key and the value elements of the dictionary. Whenever a Collection contains instances of a ValueType, the [ItemType] attribute specification is required. If an [ItemType] attribute is not specified, the Collection may contain instances of any user-defined persistent class.
The [ItemType] attribute is applied to a class field of a Collection type. For a simple collection, it takes the following general form:
For fields of IDictionary types, the types for both the key and value are specified:
[OpenAccess.ItemType(Type KeyType, Type ValueType)]
There are also constructors with a string parameter instead of Type. The types are specified as fully qualified type names. These constructors are used for Visual Basic.
You will find the descriptions for the [ItemType] attribute in the OpenAccess ORM .NET API Reference for the class ItemTypeAttribute.
The following example specifies an ArrayList field whose elements are restricted to type Address:
// . . .
// . . .