MemVarBlock Function |
Namespace: XSharp.RT
FUNCTION MemVarBlock( cMemvarName AS STRING ) AS Object
public static Object MemVarBlock( string cMemvarName )
Tip |
---|
MemVarBlock() creates set-get blocks only for variables whose names are known at runtime. MemVarBlock(), therefore, cannot be used to create set-get blocks for local or static variables. The same restriction applies to creating blocks using the macro operator (&). |
Tip |
---|
Dynamic memory variables (PUBLIC, PRIVATE, PARAMETERS) are supported in the X# language and runtime for compatibility only. In most cases the type can and should be replaced with lexically scoped variables, such as LOCALs and GLOBALs. |
1PRIVATE var := "This is a string" 2// Set-Get block defined using macro operator 3cbSetGet := &("{|setVal|; 4 If(setVal = NIL, var, var := setVal)}") 5// Set-Get block defined using MemVarBlock(). 6// It is the functional equivalent of cbSetGet above 7cbSetGet := MemVarBlock("var")