Try OpenEdge Now
skip to main content
GUI for .NET Programming
Using .NET data types in ABL : Explicit data type mappings
 

Explicit data type mappings

In many, if not most, instances of access to .NET data types, ABL allows you to specify an ABL data type that implicitly maps to the specified .NET mapped data type (see GeneralABL support for .NET types). This is true, for example, for all direct assignments between ABL primitive and corresponding .NET mapped data types and most instances of method parameter passing between these same ABL and .NET data types (see Implicitdata type mappings). However, there are certain circumstances in which you need to explicitly indicate the .NET data type to which you want to map an ABL primitive type, as shown in the following table. These circumstances include:
*When you pass ABL primitive or primitive array types to overloaded .NET method and constructor parameters where you do not want the default match (see Default matching ABL and .NET data types). For more information, see Passing ABL data types to .NET constructor and method parameters.
*When you need to manually box an ABL primitive or primitive array type to a System.Object as a .NET mapped data type or a .NET array of mapped type elements other than the default match. For more information, see .NET boxingsupport and Accessingand using .NET arrays.
*When you override an inherited .NET method; when you override an inherited abstract .NET method or property; or when you implement a property or method from a .NET interface. For more information, see DefiningABL-extended .NET objects.
Note: There is no data type mapping when you override a .NET abstract event or implement a .NET interface event because you must define the event signature with reference to a .NET delegate.
*When you substitute actual data types for type parameters in the constructed type name of a .NET generic type. For more information, see Referencing.NET generic types.
The following table shows how to specify the mapping from ABL primitive or primitive array types to .NET mapped data types or arrays of mapped type elements in a way that explicitly indicates the matching .NET data type. In general, if you want to match a .NET mapped type that is the default match for a given ABL primitive data type, you specify the ABL primitive data type as required. Otherwise, ABL provides a unique data type identifier (AS data type) that corresponds to a specific .NET mapped data type other than the default match. Note that in some rows, the ABL AS data type column is empty because the explicit .NET data type in these rows is the default (and, sometimes, the only) match for the corresponding ABL primitive (or primitive array) type. Also note that the mechanism for specifying the AS data type differs depending on the usage context and the data types involved.
Table 11. Explicit mappings from ABL primitive to .NET data types
Explicit .NET object type
Explicit C# primitive type
ABL primitive type
ABL AS data type
System.Boolean
bool
LOGICAL
System.Byte
byte
INTEGER
UNSIGNED-BYTE
System.SByte
sbyte
INTEGER
BYTE
System.DateTime
DATETIME1
System.Decimal
decimal
DECIMAL2
System.Int16
short
INTEGER
SHORT
System.UInt16
ushort
INTEGER
UNSIGNED-SHORT
System.Int32
int
INTEGER3
System.UInt32
uint
INT64
UNSIGNED-INTEGER
System.Int64
long
INT644
System.UInt64
ulong
DECIMAL
UNSIGNED-INT64
System.Double
double
DECIMAL
DOUBLE
System.Single
float
DECIMAL
FLOAT
System.Char
char
CHARACTER
SINGLE-CHARACTER
System.String
string
CHARACTER5 /LONGCHAR

1 Use this ABL primitive data type to explicitly indicate a default match, with no need for an AS data type.

2 Use this ABL primitive data type to explicitly indicate a default match, with no need for an AS data type.

3 Use this ABL primitive data type to explicitly indicate a default match, with no need for an AS data type.

4 Use this ABL primitive data type to explicitly indicate a default match, with no need for an AS data type.

5 Use this ABL primitive data type to explicitly indicate a default match, with no need for an AS data type.