Try OpenEdge Now
skip to main content
GUI for .NET Programming
Using .NET data types in ABL : Working with .NET generic types
 

Working with .NET generic types

A previous section in this book introduces .NET generic types and describes how to reference them as constructed types in ABL by substituting the type parameters (see Referencing.NET generic types). For example, .NET supports a generic sorted list object that allows you to create a sorted list of key/value pairs, where the value of a specified type is sorted by the key of a specified type. So, to define an object reference to a .NET sorted list consisting of System.String keys and System.Int16 values, you can code the following ABL statement:
DEFINE VARIABLE rKeyValueList AS CLASS
  "System.Collections.Generic.SortedList<CHARACTER, SHORT>" NO-UNDO.
In this example, the generic type name is constructed by substituting the ABL primitive type, CHARACTER, for the key type parameter (first Tparm) and the ABL AS data type, SHORT, for the value type parameter (second Tparm).
* Identifying generic type parameters
* Identifying constraints on generic type parameters