Hi. I'm trying to clean up my code. One of the annoying things is that It is full of places where I initialize a large number (for example, 30) lists at once. Something like:
B4X:
Dim a, b, c, d as List
a.Initialize
b.Initialize
c.Initialize
d.Initialize
I was wondering if there is a "cleaner" way to do this. I tried the following:
B4X:
For Each x As List in Array(a, b, c, d)
x.Initialize
Next
It didn't work. The code runs, but I get an exception saying the lists are not initialized.
Any ideas?
Thanks. It worked perfectly.
Actually, the lists hold information loaded from a database table. Each list holds the value of a specific column in all the records. I suppose it would have been a lot better if I had used custom types.