Function Calls on .NET Primitive and Enumerated Types
You can make function calls on .NET primitive and enumerated
types from a PowerBuilder application. The function calls must be
made inside a conditional compilation block for a .NET target.
.NET primitive types
To support function calls on .NET primitive types, the PowerBuilder
.NET compiler (pb2cs) merges the functionality
of these primitive types with the functionality of corresponding
PowerBuilder primitive types. This allows you to use .NET primitive
types and their corresponding PowerBuilder primitive types in a
similar fashion. The following example makes the same ToString function
call on both the .NET System.Int32 datatype
and the PowerScript long datatype:
.NET compiler (pb2cs) merges the functionality
of these primitive types with the functionality of corresponding
PowerBuilder primitive types. This allows you to use .NET primitive
types and their corresponding PowerBuilder primitive types in a
similar fashion. The following example makes the same ToString function
call on both the .NET System.Int32 datatype
and the PowerScript long datatype:
1 2 |
System.Int32 i1 long i2 |
1 2 |
i1.ToString() i2.ToString() |
For a table of equivalencies between .NET and PowerScript
primitive datatypes, see Datatype Mappings.
Note:
The System.IntPtr and SystemUIntPtr primitive
types do not have precise corresponding types in PowerBuilder�they
are always treated as long datatypes. Calling
functions or modifying properties on these .NET primitive types
leads to a compilation error in PowerBuilder.
.NET enumerated types
Function calls are also supported on .NET enumerated types
that you import to a PowerBuilder .NET target. For example, suppose
you define a .NET enumerated type in a .NET assembly as follows:
that you import to a PowerBuilder .NET target. For example, suppose
you define a .NET enumerated type in a .NET assembly as follows:
1 2 3 4 5 6 |
Public enum TimeOfDay { Morning = 0, AfterNoon, Evening } |
PowerBuilder allows you to call the ToString method
on the .NET TimeOfDay enumerated type after you import it to your
target:
on the .NET TimeOfDay enumerated type after you import it to your
target:
1 2 3 4 5 |
#if defined PBDOTNET then ns1.ns2.TimeOfDay daytime daytime = ns1.ns2.TimeOfDay.Morning! daytime.ToString() #end if |
Parent topic: Support for .NET language features
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest