在这里我添加了一个Tree
对象。如何自动添加更多名为tree2,tree3,tree4等的树实例?
public class Training03
{
static void Main(string[] args)
{
List<Tree> treeList = new List<Tree>() { };
var tree1 = new Tree();
for (int i = 0; i < 10; i++)
{
Tree obj;
obj = (Tree)Activator.CreateInstance(typeof(Tree));
}
}
}
public class Tree
{
public Tree()
{
}
}