Answer the question
In order to leave comments, you need to log in
How to instantiate a class whose name is assigned by a for iterator?
The bottom line is that you need to iterate to create several instances of a class with different names.
for(int i = 0; i < 10; i++)
{
Class i = new Class();
}
Answer the question
In order to leave comments, you need to log in
var classes = new List<Class>();
for(int i = 0; i < 10; i++)
{
classes.Add (new Class(){Name = i.ToString()});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question