Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Accessing .NET class members : Accessing .NET indexed properties and collections
 

Accessing .NET indexed properties and collections

ABL supports access to .NET indexed properties. In .NET, an indexed property has a group of values. Each of these property values is referenced by an indexer that can be defined with one or more keys. In ABL, you can only reference an indexed property whose indexer is defined with one key, as shown in the following syntax:

Syntax

[object-reference]:property-name[ key ]
The object-reference is a reference to an instance of .NET class that has an indexed property you want to reference. The property-name is the name of the indexed property, and key is a key value expression of a specified data type that identifies a particular property value. The range of valid values for key depends entirely on its definition, regardless of the data type. Like the syntax for accessing an ABL array, the square brackets of the indexer ([ ]) for an indexed property are part of the syntax.
Note: .NET documentation strongly recommends that any indexed property should only be created with one key for the indexer, and this is how all indexed properties are defined for the Microsoft .NET Framework. However, it is possible that other third-party .NET classes could define indexed properties with two or more keys for the indexer, in which case you cannot access those indexed properties in ABL.
Microsoft .NET class library documentation identifies indexed properties using the following indications: it typically is defined as a default property with the name, Item (see Defaultindexed properties), and the language-specific property signature always includes an index definition. For example, a C# indexed property definition might be shown as in the following example of some Control property, where this refers to the class in which the indexed property is defined and index identifies the data type of the single indexer key:
public virtual Control this [
         int index
] { get; }
.NET primarily uses indexed properties to access the items of collections, which are objects that allow you to manage collections of other objects. OpenEdge also provides indexed properties on its OpenEdge .NET class, Progress.Data.BindingSource (ProBindingSource). For more information on the ProBindingSource, see BindingABL Data to .NET Controls.
* Accessing .NET indexed properties dynamically
* Default indexed properties
* Indexed property overloading
* Indexed properties in chained references
* Working with collections