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 : Indexed property overloading
 
Indexed property overloading
Unlike the case for an ABL array index, the data type of an indexed property's key does not have to be an INTEGER. Also, .NET allows overloaded indexed properties within a class that are distinguished by the data type of the index key, similar to parameter data types of overloaded methods. For example in ABL, the default indexed property of the Control+ControlCollection class can be indexed by either an INTEGER or a CHARACTER (or LONGCHAR) data type.
Note that some ABL data types map implicitly to more than one .NET data type. This affects how ABL identifies the indexed property to access. If a property indexer key is overloaded by multiple .NET data types that implicitly map to a single ABL data type, and you specify an indexer using that ABL data type, ABL uses the indexer key whose .NET data type is the default match for the ABL data type. For example, if an indexed property key is overloaded by the C# data types short and int (both of which map to INTEGER in ABL), ABL always accesses the property by the int key. However, if there is no key defined with the default matching data type, ABL chooses the first key that it encounters that is an implicit match for the specified ABL data type.
Note: This means that without a default-matching key defined for the property, you cannot be sure which key ABL will use among the keys that map implicitly to the specified ABL data type. However, it always uses the same one for a given indexed property.
You also cannot disambiguate overloaded indexed property keys using the ASdata-type option that is available for method parameters (see Specifying .NET constructor and method parameters). Using this option on property index keys raises a compile-time error.
ABL also respects data type widening for the match. For more information on .NET data type mappings and the default matches for ABL data types, see Using.NET data types in ABL.