Skip to main content

Defining Collection Properties

Defining Collection Properties

To define list or array properties, use these property definition syntaxes:

Property MyProp as list of Type;
Property MyProp as array of Type;

Here, MyProp is the property name, and Type is either a data type class or an object class.

This example shows how to define a property for a list of %StringOpens in a new tab values.

Property Colors as list of %String;

This code shows how to define a property for an array of Doctor objects.

Property Doctors as array of Doctor;

InterSystems IRIS represents these collection properties as instances of classes in the %Collection package. These classes contain the methods and properties that you can use to work with these collections, as follows:

Note:

Do not use the %Collection classes directly as the type of a property. For example, do not create a property definition like this:

Property MyProp as %Collection.ArrayOfDT;

FeedbackOpens in a new tab