Explicit data type mappings
- Last Updated: June 18, 2019
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
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 General ABL 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 Implicit data 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 Pass 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.Objectas a .NET mapped data type or a .NET array of mapped type elements other than the default match. For more information, see .NET boxing support and Access and use .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 Extend .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 Reference .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.
| 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
|
DECIMAL1
|
– |
System.Int16
|
short
|
INTEGER
|
SHORT
|
System.UInt16
|
ushort
|
INTEGER
|
UNSIGNED-SHORT
|
System.Int32
|
int
|
INTEGER1
|
– |
System.UInt32
|
uint
|
INT64
|
UNSIGNED-INTEGER
|
System.Int64
|
long
|
INT641 |
– |
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
|
CHARACTER1
/LONGCHAR
|
– |