Click or drag to resize

IVarGet Function

X#
Return the contents of an exported instance variable.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION IVarGet(
	oObject AS Object,
	symInstanceVar AS STRING
) AS USUAL
Request Example 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#
 1CLASS GetVars
 2    EXPORT cName
 3    INSTANCE cTrick
 4CONSTRUCTOR CLASS GetVars
 5    cName := "Eve"
 6    cTrick := "Apple"
 7END CLASS
 8
 9FUNCTION Start()
10    LOCAL oVars AS OBJECT
11    oVars := GetVars{}
12    ? IVarGet(oVars, #cName)            // Eve
See Also