B4J Question (Solved) Get the Name of a List

Solution
The name a variable or object / class is something that appears in the ide environment but is lost in compilation, so in execution asking for a name makes no sense.
This is especially true for those variables that are indicated by reference.

You can achieve a similar thing with the Map though.

B4X:
NameList.Put(List,"Name")
NameList.Get(List)

Star-Dust

Expert
Licensed User
Longtime User
No
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The name a variable or object / class is something that appears in the ide environment but is lost in compilation, so in execution asking for a name makes no sense.
This is especially true for those variables that are indicated by reference.

You can achieve a similar thing with the Map though.

B4X:
NameList.Put(List,"Name")
NameList.Get(List)
 
Upvote 3
Solution

DonManfred

Expert
Licensed User
Longtime User
Put the List(s) into a Map an use the KEY as name.
 
Upvote 1

TILogistic

Expert
Licensed User
Longtime User
or

B4X:
    Dim Name As String = "MyList"

    Dim MyList As List
    MyList.Initialize
    
    Dim NameList As Map = CreateMap(Name : MyList)
    NameList.Get(Name).As(List).AddAll(Array As Int(1, 2, 3, 4, 5))
    Log(NameList.Get(Name))
 
Upvote 0
Top