IvarListClass Function | |
Store all instance variables of a class into an array.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION IvarListClass(
symClass AS STRING
) AS ARRAY
public static Array IvarListClass(
string symClass
)
Request Example
View SourceParameters
- symClass
- Type: String
The class containing the instance variable to store.
Return Value
Type:
Array
An array of symbols containing the name of all instance variables and access methods of
symClass.
Remarks
This conversion can offer you additional flexibility in manipulating data and can allow you to utilize powerful array functions, such as AEval() and AScan().
The scope throughout the function call is SELF.
Note that this function does not store PROTECT or HIDDEN instance variables.
Examples
This example uses IVarListClass() to store INSTANCE and EXPORT instance variables into an array.
It then prints the stored instance variables. (Note that the password is not stored in the array because it is a protected instance variable.)
1CLASS Person
2 EXPORT name
3 INSTANCE grade
4 PROTECT password
5CONSTRUCTOR(tname, tgrade, tpassword)
6 name := tname
7 grade := tgrade
8 password := tpassword
9END CLASS
10
11FUNCTION MakeArray() AS VOID
12 LOCAL a AS ARRAY
13 a := IVarListClass(#Person)
14
15 FOR i := UPTO ALen(aObject)
16 QOut(a[i])
17 NEXT
18
19
See Also Reference
IvarListClass(String)