I have few variables named as am_2,am_1,am_3 and so on.
I have to find the count by typing: am_2.Count(), am_1.Count() and so on.
I want to do the same in a loop. Right now I will have to write all of them separately like:
am_2.Count(),am_1.Count(),am_3.Count()....
Is there a way that I can get the Count by not typing the variable name again and again and can do it in a loop. I tried the following code, but it did not work:
for(i=1;i<=12;i++)
{
string sm="am_"+1;
if(sm.Count()==1)
{
Do the task.....
}
}
But the above code does not work. Any suggestions?