Access list (or array) name through a string variable

Hello all!
I’ve a (maybe) quite a weird problem to solve: I should iterate through all the lists (or arrays) that share the same name, so I can’t access them directly with their name, but I should use a string variable.

I try to explain better:
Let’s say I have these list

Home1(…)
Home2(…)
Home3(…)
Door1(…)
Door2(…)

Well, I should find all the lists that has in the first 4 characters of their name the string “Home” (Home1, Home2, Home3), so to know that them are 3.

Is it possible?
Many thanks!

Daniele

You can do this with reflection. I do not recommend opening that can of worms unnecessarily, though. There is probably a simpler way to do what you want to do. However how this can be done is heavily dependent on your project setup.

One thing you could do, for example: you could wrap an array in a class that has a string-identifier. These classes then register with a central list which keeps track of all these objects.
When you want to iterate through all the arrays, you find the ones that match your string and iterate through those.

If you provide more details about your project and the context in which you want to do this, I could give more concrete help.

Thank-you DerDude!
Basically I have to compare many arrays (generic-lists) to see which item is shared through differents arrays.
But I can call each of them one after the other, since:

  1. them are too many
  2. I have to compare them multiple times in multiple ways
  3. the number of these arrays will increase or decrease quickly during the development,

so I have to write a code to count them and compare the items “automatically”

Daniele