[Solved] Naming a variable based on another variable


No, you can’t, and it makes no sense honestly to have a feature like that.

If you want , you can use a dictionary, where you can have the key be a string:

 Dictionary<string, RectangleShape> shapes = new Dictionary<string, RectangleShape>();
    shapes.Add("nameTheKey", new RectangleShape( ... ));

Then you can simply read the “variable” like

shapes["nameTheKey"]

solved Naming a variable based on another variable