Datatype Mappings – PB Docs 126


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:

Datatype mappings in managed assembly methods

.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

For example, suppose you want to reference a method foo with
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:

In PowerScript code, you must replace the foo method
datatypes with their PowerBuilder datatype equivalents (long for int, longlong for long):

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:

Mappings for PowerScript datatypes unsupported in .NET

PowerBuilder datatype

C# datatype

.NET datatype

Blob

Byte [ ]

System.Byte [ ]

Date

System.Datetime

System.Datetime

Time

System.Datetime

System.Datetime


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x