Try OpenEdge Now
skip to main content
GUI for .NET Mapping Reference
Mapping Reference Entries : Implicit data type mapping between ABL primitive and .NET types
 

Implicit data type mapping between ABL primitive and .NET types

The following table lists implicit data type mappings between ABL primitive types and corresponding .NET data types. This implicit mapping means that the corresponding data types can be assigned to each other:
Table 12. Implicit data type mapping between ABL primitive and .NET types
Implicit .NETobject type
Implicit C#primitive type
Implicit ABLprimitive type
System.Boolean
bool
LOGICAL
System.Byte
byte
INTEGER
System.SByte
sbyte
INTEGER
System.DateTime
DATETIME
System.Decimal
decimal
DECIMAL
System.Int16
short
INTEGER
System.UInt16
ushort
INTEGER
System.Int32
int
INTEGER
System.UInt32
uint
INT64
System.Int64
long
INT64
System.UInt64
ulong
DECIMAL
System.Double
double
DECIMAL
System.Single
float
DECIMAL
System.Char
char
CHARACTER
System.String
string
CHARACTER LONGCHAR
ABL also automatically maps one-dimensional .NET arrays to ABL arrays. So, assuming that the arrays are the same size, the corresponding .NET and ABL array types in the following table can be assigned to each other.
Table 13. Example implicit mappings between one-dimensional .NET arrays and ABL arrays
.NET array type
Corresponding ABL array type
System.Drawing.Point[]
System.Drawing.Point EXTENT
System.Windows.Forms.Button[]
System.Windows.Forms.Button EXTENT
System.Int32[]
INTEGER EXTENT
System.Byte[]
INTEGER EXTENT
Notice that you can assign between the same ABL primitive array type and a .NET array of the same size and any implicitly mapped .NET type. So, the same ABL INTEGER array can be assigned to a .NET array of System.Int32 or System.Byte (as shown), or of any other supported mapping, such as System.Int16, and so on.
The following table lists the default match between the specified ABL primitive type and its corresponding .NET data type.
Table 14. Default match between specified ABL primitive types and corresponding .NET data types
ABLprimitive type
Default match (.NET object type)
Default match (C# primitive type)
CHARACTER
System.String
string
DATETIME
System.DateTime
DECIMAL
ystem.Decimal
decimal
INT64
System.Int64
long
INTEGER
System.Int32
int
LOGICAL
System.Boolean
bool
This means that in the following situations, the ABL type matches the corresponding .NET type by default:
*When assigning the ABL primitive type to a System.Object
*When passing the ABL primitive type as a parameter to an overloaded .NET method
*When overriding a .NET method or implementing a .NET interface
For all of the above situations, you can also explicitly indicate any available .NET data type mapping other than the default (see Explicit data type mapping from ABL primitive to .NET types.)
The following table shows examples of implicit data type mappings.
Table 15. Example implicit mappings between ABL and .NET types
Operation description
Operation using Type of data element
Assign an INTEGER value to a System.Int16 data element (creating a new System.Int16 object in the process)
System.Int16 = INTEGER.
Assign a System.Int16 value to an INTEGER data element
INTEGER = System.Int16.
Pass an INTEGER value to the System.Int16 parameter of a .NET method (creating a new System.Int16 object in the process)
Method( INPUT INTEGER).
Assign the elements of a DECIMAL array to a System.Double[] array data element (creating a new System.Double[] array object that contains all the element values of the DECIMAL array source)
System.Double[] = DECIMAL EXTENT.
Assign the elements of a System.Double[] array object to a DECIMAL array of the same extent
DECIMAL EXTENT = System.Double[].
Pass a DECIMAL array value to the System.Double[] parameter of a .NET method (creating a new System.Double[] array object containing all the element values of the DECIMAL array argument)
Method( OUTPUT DECIMAL EXTENT ).