Language Interoperability
\The Sandbox \PB History & Future \New in PB11.5 \Language Interoperability
New DW Features
3D Graph Styles
PNG Support
DB Interface
Enhancements
.NET Target
Enhancements
Language
Interoperability
Trans'n Object
Enhancement
FDCC
Compliance
Silent Install &
Uninstall
Feature
Deprecation

Support for function calls on .NET primitive and enumerated types

PowerBuilder 11.5 includes support for functions that you call on .NET primitive and enumerated types. The function calls must be made inside a conditional compilation block for a .NET target.
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 means that you can 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:

    System.Int32 i1   
    long i2
    i1.ToString()
    i2.ToString()

Exception for platform-specific primitive types  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.

For a table of equivalencies between .NET and PowerScript primitive datatypes, see the chapter on "Referencing .NET Classes in PowerScript" in the Deploying Applications and Components to .NET book.

Function calls are also supported on .NET enumerated types that you import to a PowerBuilder .NET target. For example, suppose we define a .NET enumerated type in a .NET assembly as follows:

    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:

    #if defined PBDOTNET then
        ns1.ns2.TimeOfDay daytime
        daytime = ns1.ns2.TimeOfDay.Morning!
        daytime.ToString()
    #end if

Using instance references to access static .NET class members

PowerBuilder 11.5 lets you use instance references to access static members of .NET classes. The following is an example of an instance reference you can use for a static member of the System.Web.HttpContext class:

    string s
    #if defined PBDOTNET then
        //OLD WAY
        //s=System.Web.HttpContext.Current.ToString()   
        //NEW WAY
        System.Web.HttpContext context
        context  = create System.Web.HttpContext   
        s = context.Current.ToString()
    #end if

PBL Peeper PB Help PB History
& Future About Us Feedback Site Map

Google
 
Web www.techno-kitten.com
www.sybase.com