First off I'm sure that I am using the wrong terminology here but I will fix it if someone comments on it. Please be gentle.
So I have multiple charts
on a page and I am performing virtually identical actions on each. For demonstrative purposes lets call my charts
something like: chart1
, chart2
, ..., chartn
where n is somewhere in the vicinity of 20. What I would like to do is drop this in a for
loop and perform all the work in one smaller chunk of code, especially if I have to tweak it later.
So my question is whether or not I can vary the n part representing the object (terminology?) so I can get this done more efficiently.
i.e.:
for(int i = 0; i < 20; i++)
{
String chartName = "chart" + i;
chartName.Series.Clear();
}
I have a feeling you can't do this with a string so I was looking into doing a foreach
but I don't know how to do this with charts.
Thanks a lot!