You could store the values in a Dictionary
in C#. That way you could retrieve a value according to a specific key.
IDictionary<string, object> variables = new Dictionary<string, object>();
Add a variable:
variables.Add("varname", 11);
Then to retrieve te variables you can use:
var myVar = variables.SingleOrDefault(x => x.Key == "varname");
Note to include using System.Linq;
to use .SingleOrDefault()
Because the object
type is used as a value, all kinds of variables can be stored; (int, string, custom class instances). but note that you'll have to cast the variable back to your type when using it
EDIT: If you only use Timers, use this dictionary declaration:
IDictionary<string, Timer> variables = new Dicitonary<string, Timer>();