+ 1
Create object in for loop? (C#)
I want to create a object but several times just like this: for (int Zero; Zero < VarCounter; Zero++;) { Class Sub = new Class(); } But I need to create various "Sub" with different names, how can I do that?
2 ответов
+ 3
Perhaps use an array:
Class arr = new Class[VarCounter];
for (int Zero; Zero < arr.length; Zero++)
arr[Zero] = new Class();
+ 1
Thanks!