Support for .NET language features – PB Docs 120


Support for .NET language features

When
you use conditional blocks of code for the .NET environment, you
can take advantage of features that are not available
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:

    Alternatively, you can access static .NET properties without
    using instance references, as the following code illustrates:

  • 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.

    See User-Defined Enumerations.

  • 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.

    See Function Calls on .NET Primitive and Enumerated Types
    .

  • .NET index access � you can access the indexes of .NET classes in the same way
    you access PowerBuilder array elements.

    See Accessing Indexes for .NET Classes
    .

  • 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:

  • 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.

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