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 |
public class MyClass
{
public int foo(int a, long b);
{
return a + b
}
}
long p1, returnValue
longlong p2
#IF Defined PBWINFORM Then
MyClass instanceOfMyClass
instanceOfMyClass = create MyClass
returnValue = instanceOfMyClass.foo(p1, p2)
#END IF
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: