I want to create several rectangles (with dynamic names) by changing the name of the rectangle
int[] num= { 1, 2, 3, 4 }; //I need infant number of rectangle but here only a symbol of four numbers.
for (int i = 0; i < 3; i = i + 1)
{
string mystring= "regctangle"+num[i].ToString();
string rectanglename = myString; //this is the rectangle name change with the loop
Rectangle rectanglename= new Rectangle(10, 10, 3, 3);
}
The results should be for first iteration rectangle
rectangle1
rectangle2
rectangle3
rectangle4
Aucun commentaire:
Enregistrer un commentaire