Support for .NET language features
You can write conditional code for the .NET environment, taking advantage of features
that are not available directly in the PowerBuilder Classic application
environment.
- Support for sbyte and ulonglong �
sbyte is the signed format of the byte
datatype and ulonglong is the unsigned format of the
longlong datatype. - Bitwise operators � see Bitwise Operator Support.
- Parameterized constructors � arguments are
not permitted in constructors for standard PowerBuilder applications, but they are
supported in conditional code blocks for the .NET environment. - Static fields and methods � static fields
and methods are not permitted in standard PowerBuilder applications, but they are
supported in conditional code blocks for the .NET environment.You can use
instance references to access static members of .NET classes, as in the
following example for the static property “Now” of the System.DateTime class:1#if defined PBDOTNET then1 System.DateTime dt_instance 1 System.DateTime current_datetime1 dt_instance = create System.DateTime 1 current_datetime = dt_instance.Now1#end ifAlternatively, you can access static .NET properties without using instance
references, as the following code illustrates:1#if defined PBDOTNET then1 System.DateTime current_datetime1 current_datetime = System.DateTime.Now1#end if - Namespaces, interfaces, and user-defined
enumerations � you can reference namespaces and .NET interfaces and enumerations in
conditional code blocks for the .NET environment. In standard PowerScript code,
namespaces are not available and you cannot declare an interface or
enumeration. - Function calls on .NET primitive types and
enumerations � the pb2cs compiler merges functionality of .NET
primitive types with the functionality of corresponding PowerBuilder primitive
types. Function calls are also supported on .NET enumerated types that you import to
a PowerBuilder .NET target. - .NET index access � you can access the
indexes of .NET classes in the same way you access PowerBuilder array elements. - Function arguments defined as out
parameters � in .NET, functions can pass parameters using the �out� passing mode.
Although there is no equivalent concept in PowerScript, you can access �out�
parameters�as well as parameters passed by reference�using the �ref� keyword..NET also allows you to overload a function that has a parameter passed by
value with a prototype that differs only in the passing mode of the parameter.
In these cases, if you want to call the function prototype with the parameter
that uses the reference or out passing mode, you must use the ref keyword in
your PowerScript call:1my_obj.TestMethod(ref l_string)
- Bitwise Operator Support
Standard PowerBuilder applications allow the use of the logical operators AND, OR, and NOT to evaluate boolean expressions. In .NET applications and components, in addition to evaluating boolean expressions, you can use these same operators to perform bitwise evaluations. - User-Defined Enumerations
To use enumerations that you import from a .NET assembly, you must surround the enumeration references in a conditional compilation block that is valid for your .NET target environment. - 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. - Accessing Indexes for .NET Classes
You can access the indexes of .NET classes in the same way you access PowerBuilder array elements. However, in standard PowerBuilder applications, you can reference indexes only using integral datatypes, such as integer, short, long, and so on. - Using Multithreading
When you deploy a PowerBuilder application that contains shared objects or an NVO assembly to .NET, the application can be run in a multithreaded environment. The PowerBuilder .NET runtime library also supports .NET synchronization, enabling your application to avoid possible data corruption.
Parent topic: Conditional Compilation
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest