You could with reflection, but I suspect that in this case theere is the best design you could implement, it would be better than using reflection. If you provide a little more information, perhaps one of us can help you with this.
Declare a dictionary variable:
Dictionary<string, RectangleShape> rectangleDictionary = new Dictionary<string, RectangleShape>();
Then, where you would specify the normal code "matrix1_2 = somevalue;", instead write:
rectangleDictionary.add("matrix1_2", somevalue)
Then you can work with the variable name:
rectangleDictionary["matrix1_2"] = someothervalue; rectangleDictionary["matrix1_2"].someproperty = something; Microsoft.VisualBasic.PowerPacks.RectangleShape y = rectangleDictionary["matrix1_2"];
source share