^AS

Convert an expression to another type

 

WNSupported in Synergy .NET on Windows

 

 

var = ^AS(expression, type)

Return value

var

An instance of the specified type, or ^NULL if the expression cannot be converted.

Arguments

expression

An expression to be converted. (a)

type

A reference or a nullable type name to convert to. (a)

Discussion

The ^AS function attempts to convert the specified expression to the given type at runtime.

Examples

main
record
    cvar,       @class1
    ovar,       @*
proc
; Same assignment
    ovar = new class1()
    cvar = ^as(ovar, class1)
    if (cvar .ne. ^null) then
      console.writeline("GOOD class1 not null")
    else
      console.writeline("BAD class1 null")