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

Implicit data type mappings

The following table shows the implicit mappings between .NET mapped data types and ABL primitive types. These .NET mapped data types are shown in two forms—as object types and as C# primitive data types. .NET has more mapped data types than the ABL has primitive types. So, more than one .NET type often maps to a single ABL primitive type. Where an exact mapping is not possible, ABL uses the primitive type that most completely holds the value. For these cases, and a few others, run-time errors can result if a provided value does not fit into the destination data type. Entries in the table have footnotes to indicate where any special conditions can or do occur. For more information on these conditions, see the sections following the table.
Note also that ABL supports similar implicit mappings between ABL primitive arrays and .NET arrays of mapped data types. For more information, see Implicitarray mappings.
Table 10. Implicit mappings between .NET and ABL data types
Implicit .NETobject type
Implicit C#primitive data type
Implicit ABLprimitive type
System.Boolean
bool
LOGICAL
System.Byte
byte
INTEGER1,2
System.SByte
sbyte
INTEGER1
System.DateTime
DATETIME
System.Decimal
decimal
DECIMAL3,4
System.Int16
short
INTEGER5
System.UInt16
ushort
INTEGER6,7
System.Int32
int
INTEGER8
System.UInt32
uint
INT649,10
System.Int64
long
INT6411
System.UInt64
ulong
DECIMAL12,13
System.Double
double
DECIMAL14
System.Single
float
DECIMAL15
System.Char
char
CHARACTER16
System.String
string
CHARACTER17
LONGCHAR18

1 An ABL INTEGER is a 32-bit number. Thus, it can hold values that are too big to store in a .NET System.Byte, System.SByte, System.Int16, or System.UInt16. Therefore, AVM raises a run-time error if an incompatible value is assigned.

2 If you pass a negative ABL data type to an unsigned data type, the ABL virtual machine (AVM) raises a run-time error.

3 The range of values for a .NET System.Decimal and the range of values for an ABL DECIMAL are not equivalent. In particular, an ABL DECIMAL can be a much larger positive number or a much smaller negative number than a .NET System.Decimal can represent, and a .NET System.Decimal can represent a positive or negative number with much higher precision (with more significant digits to the right of the decimal point) than an ABL DECIMAL can represent. Therefore, the AVM raises a run-time error if you assign too large or too small of an ABL DECIMAL value to a .NET System.Decimal. If you assign too precise a .NET System.Decimal to an ABL DECIMAL, with too many significant digits to the right of the decimal point, ABL truncates the least significant digits necessary to represent the value as an ABL DECIMAL.

4 If you specify this ABL data type for a parameter of an overloaded .NET method and some overloads are distinguished by multiple .NET data types that match this same ABL data type, ABL automatically maps the corresponding .NET data type as the default match for the specified ABL data type. For example, if the method is overloaded by a parameter for both System.Decimal and System.Double, ABL automatically maps a specified ABL DECIMAL to System.Decimal, unless you indicate otherwise. For information on indicating a particular .NET data type mapping for a given ABL data type, see Indicating explicit .NET data types.

5 An ABL INTEGER is a 32-bit number. Thus, it can hold values that are too big to store in a .NET System.Byte, System.SByte, System.Int16, or System.UInt16. Therefore, AVM raises a run-time error if an incompatible value is assigned.

6 An ABL INTEGER is a 32-bit number. Thus, it can hold values that are too big to store in a .NET System.Byte, System.SByte, System.Int16, or System.UInt16. Therefore, AVM raises a run-time error if an incompatible value is assigned.

7 If you pass a negative ABL data type to an unsigned data type, the ABL virtual machine (AVM) raises a run-time error.

8 If you specify this ABL data type for a parameter of an overloaded .NET method and some overloads are distinguished by multiple .NET data types that match this same ABL data type, ABL automatically maps the corresponding .NET data type as the default match for the specified ABL data type. For example, if the method is overloaded by a parameter for both System.Decimal and System.Double, ABL automatically maps a specified ABL DECIMAL to System.Decimal, unless you indicate otherwise. For information on indicating a particular .NET data type mapping for a given ABL data type, see Indicating explicit .NET data types.

9 An ABL INT64 is a 64-bit number. Thus, it can hold values that are too big to store in a .NET System.UInt32. Therefore, AVM raises a run-time error if an incompatible value is assigned.

10 If you pass a negative ABL data type to an unsigned data type, the ABL virtual machine (AVM) raises a run-time error.

11 If you specify this ABL data type for a parameter of an overloaded .NET method and some overloads are distinguished by multiple .NET data types that match this same ABL data type, ABL automatically maps the corresponding .NET data type as the default match for the specified ABL data type. For example, if the method is overloaded by a parameter for both System.Decimal and System.Double, ABL automatically maps a specified ABL DECIMAL to System.Decimal, unless you indicate otherwise. For information on indicating a particular .NET data type mapping for a given ABL data type, see Indicating explicit .NET data types.

12 If you pass a negative ABL data type to an unsigned data type, the ABL virtual machine (AVM) raises a run-time error.

13 An ABL DECIMAL can represent a much larger number than a System.UInt64. Therefore, AVM raises a run-time error if an incompatible value is assigned.

14 An ABL DECIMAL represents numbers up to 50 digits long. As a result, an ABL DECIMAL value cannot represent the full range of values for a .NET System.Double or System.Single. Therefore, AVM raises a run-time error if an incompatible value is assigned. Also, an ABL DECIMAL can lose precision when it is represented by a .NET System.Double or System.Single.

15 An ABL DECIMAL represents numbers up to 50 digits long. As a result, an ABL DECIMAL value cannot represent the full range of values for a .NET System.Double or System.Single. Therefore, AVM raises a run-time error if an incompatible value is assigned. Also, an ABL DECIMAL can lose precision when it is represented by a .NET System.Double or System.Single.

16 This ABL CHARACTER mapping supports a single Unicode character.

17 If you specify this ABL data type for a parameter of an overloaded .NET method and some overloads are distinguished by multiple .NET data types that match this same ABL data type, ABL automatically maps the corresponding .NET data type as the default match for the specified ABL data type. For example, if the method is overloaded by a parameter for both System.Decimal and System.Double, ABL automatically maps a specified ABL DECIMAL to System.Decimal, unless you indicate otherwise. For information on indicating a particular .NET data type mapping for a given ABL data type, see Indicating explicit .NET data types.

18 When the value comes from .NET, ABL converts from System.String to either CHARACTER or LONGCHAR, depending on the length of the character string. When the value comes from ABL, System.String accepts values from either CHARACTER or LONGCHAR.

* Implicit array mappings
* An ABL INTEGER larger than its .NET destination
* Negative ABL values and unsigned .NET destinations
* ABL DECIMAL and .NET System.Decimal
* Default matching ABL and .NET data types
* An ABL INT64 larger than its .NET System.UInt32 destination
* An ABL DECIMAL larger than its .NET System.UInt64 destination
* ABL DECIMAL and .NET System.Double or System.Single