Is there a way to use a variable as a part of a method’s name?

Hello. I'm really new to c#, so my question may be very basic, but I would greatly appreciate any help.

I'm writing a program which contains lots of (~80) charts. My points values introduction for a single one is looking like this:

chart_A1.Series["Series1"].Points.Add(1); chart_A1.Series["Series2"].Points.Add(1); chart_A1.Series["Series3"].Points.Add(1); chart_A1.Series["Series4"].Points.Add(1); 

I would like to use a loop for all the charts based on the array which contains all their names (smth like {A1, A2, A3, A4, B1, B2, B3, B4, C1…}). So is there a way I can do it? Thanks a lot for your time!

by novebra via /r/csharp

Leave a Reply