Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Referencing and instantiating .NET classes : Referencing .NET class and interface types : Referencing arrays of objects
 
Referencing arrays of objects
In .NET, all arrays are object types that inherit from the System.Array class and can have any number of dimensions. Therefore, you can reference all .NET arrays as instances of either System.Array or the particular derived array object type. Note that whatever array type you use to access a .NET array, the class members for setting and getting the array elements access the elements as objects of type System.Object (the .NET root class). So, ABL also supports mechanisms to access the underlying type of these System.Object array elements.
For example, the following statement defines an object reference to a two-dimensional .NET array of Button objects:
DEFINE VARIABLE rButtonArray
  AS CLASS "System.Windows.Forms.Button[,]" NO-UNDO.
Note that in a .NET array type name, the double brackets ([]) specify the array dimensions. An empty pair of brackets specifies an array of one dimension, and you add as many embedded commas as necessary to specify the number of additional dimensions for the array type. Also, in ABL, you must use the surrounding double-quotes as part of the type name in order to allow the bracket characters in the name. Unlike an ABL array (which is not an object), a .NET array type name does not include the number of elements (the extent) in each dimension of the specified array. You specify .NET array extents when you create the array object at run time.
You can also assign directly between any one-dimensional .NET array and an ABL array (EXTENT variable) of compatible element type and extent. ABL thus supports the implicit mapping of array element types when you assign between compatible ABL and.NET arrays.
For more information on .NET arrays and working with them in ABL, see Accessing and using .NET arrays.