Datatype Mappings
When you call methods from managed
assemblies in PowerScript, you must use PowerBuilder datatypes in
any method arguments or return values.
This table shows the mappings between .NET, C#,
and PowerBuilder datatypes:
.NET datatype |
C# datatype |
PowerBuilder datatype |
---|---|---|
System.Boolean |
boolean |
Boolean |
System.Byte |
Byte |
Byte |
System.Sbyte |
Sbyte |
Sbyte |
System.Int16 |
short |
Int |
System.UInt16 |
ushort |
Uint |
System.Int32 |
int |
Long |
System.UInt32 |
uint |
Ulong |
System.Int64 |
long |
Longlong |
System.UInt64 |
ulong |
Unsignedlonglong |
System.Single |
float |
Real |
System.Double |
Double |
Double |
System.Decimal |
Decimal |
Decimal |
System.Char |
Char |
Char |
System.String |
String |
String |
System.DateTime |
System.Datetime |
Datetime |
arguments that require separate int and long datatype values when
you call the method in C# script. The class containing
this method is defined in an assembly in the following manner:
1 |
public class MyClass |
1 |
{ |
1 |
public int foo(int a, long b); |
1 |
{ |
1 |
return a + b |
1 |
} |
1 |
} |
datatypes with their PowerBuilder datatype equivalents (long for int, longlong for long):
1 |
long p1, returnValue |
1 |
longlong p2 |
1 |
#IF Defined PBWINFORM Then |
1 |
MyClass instanceOfMyClass |
1 |
instanceOfMyClass = create MyClass |
1 |
returnValue = instanceOfMyClass.foo(p1, p2) |
1 |
#END IF |
Calling PowerScript methods from .NET assemblies
If you generate a .NET assembly or Web service from a PowerBuilder
target, the generated methods can be called by a different .NET
assembly or application, but these calls must be made using .NET
syntax and datatypes. In the table for Datatype mappings in managed assembly methods, the datatype mapping is bidirectional,
so you can call methods on the .NET assemblies you generate from
PowerBuilder using the .NET equivalents for PowerScript datatypes
shown in the table.
Some PowerScript datatypes do not have a one-to-one correspondence
with datatypes in .NET. When you generate a .NET assembly or Web
service from PowerBuilder, PowerBuilder converts these datatypes
as shown in the following table. If
you call methods using these datatypes from a .NET application,
you must substitute the .NET datatype equivalents shown in this
table: