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

Default matching ABL and .NET data types

In the implicit mappings shown in Table 10, four of the listed ABL primitive types can each represent two or more .NET data types. One of the .NET data types mapped to each of these four ABL data types is a default matching .NET data type. If you pass one of these ABL data types to a .NET method that is overloaded by that parameter using more than one of its corresponding mapped .NET data types, and one these mapped .NET data types is the default match for that ABL data type, ABL chooses this default matching .NET data type to map the specified ABL data type.
The following table shows the six basic ABL data types, each listed with its default matching .NET data type (with reference to the .NET mapped object and C# primitive data types).
ABLprimitive type
Default match(.NET object type)
Default match(C# primitive type)
CHARACTER
System.String
string
DATETIME
System.DateTime
DECIMAL
System.Decimal
decimal
INT64
System.Int64
long
INTEGER
System.Int32
int
LOGICAL
System.Boolean
bool
For example, if you pass an ABL INTEGER to a .NET method that is overloaded three times by one parameter with the System.Int32, System.Byte, and System.UInt16 data types, ABL calls the method that maps the ABL INTEGER to the .NET System.Int32 parameter.
Note that if the parameter is overloaded only by data types other than the default matching data type, for example System.Byte and System.UInt16, ABL raises a compile-time ambiguity error unless you explicitly indicate the .NET parameter data type you want to map. For more information on indicating the exact .NET data type for mapping an ABL data type passed to a .NET method parameter, see Indicating explicit .NET data types.
Note that this default matching applies also to mapping ABL primitive array types to .NET arrays of mapped types. For example, if you pass an ABL INTEGER array to a .NET method that is overloaded three times on one parameter by the "System.Int32[]", "System.Byte[]", and "System.UInt16[]" array types, ABL implicitly calls the method that maps the ABL INTEGER array to the .NET "System.Int32[]" parameter.
Note, also, that if the parameter is overloaded only by data types other than the default matching data type, for example System.Byte and System.UInt16, ABL raises a compile-time ambiguity error unless you explicitly indicate the .NET parameter data type you want to map using an AS data type. You can do this for mapping both ABL primitive data type and ABL primitive array type arguments. For more information on indicating the exact .NET data type for mapping an ABL type passed to a .NET method parameter, see Indicating explicit .NET data types.