Click or drag to resize

IVarGet Function

Return the contents of an exported instance variable.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION IVarGet(
	oObject AS Object,
	symInstanceVar AS STRING
) AS USUAL
View Source

Parameters

oObject
Type: Object
The object containing the exported instance variable.
symInstanceVar
Type: String
The exported instance variable to get.

Return Value

Type: Usual
The value of <symInstanceVar>.
Remarks
IVarGet() returns the contents of an exported instance variable.  The symbol of this instance variable can be stored inside <symInstanceVar> at runtime.  Therefore, the instance variable does not have to be known at compile-time.  The class operator (:) also returns the contents of an exported instance variable, but the instance variable must be known at compile-time.
Examples
This example uses IVarGet() to retrieve the contents of an exported instance variable.  Note that the contents of cTrick cannot be retrieved via IVarGet() since it is an INSTANCE variable.
X#
CLASS GetVars
        EXPORT cName
        INSTANCE cTrick
METHOD Init CLASS GetVars
        cName := "Eve"
        cTrick := "Apple"
FUNCTION Start()
        LOCAL oVars AS OBJECT
        oVars := GetVars{}
        ? IVarGet(oVars, #cName)                        // Eve
See Also