本文介绍了如何创建一个创建类的多个对象的循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 (这有可能吗?)所以(例如)我想要一个名为Fruit的课程...... class Fruit { private string _name; public string Name {get {return _name; } } 我想制作一个循环,创造了一堆这些所谓的"水果"。像这样(我知道这不会像这样工作但是)... for(int i = o; i< 100; i ++) { Fruit Apple< i> =新水果(); } 我希望这些对象的名称会像"Apple0","Apple1"一样出现。 ,"Apple2"...... 所以。 这甚至可以用c#或ANY编程语言(当然是以不同的方式)吗? 谢谢。解决方案 (Is this even possible?) So (for example) I wanted a class called Fruit...class Fruit{ private string _name; public string Name { get { return _name; } }}and I wanted to make a loop that created a bunch of these said "Fruits" like this (I know this wouldn't work like this but)...for (int i = o; i < 100; i++){ Fruit Apple<i> = new Fruit();}and I would hope that the names of these objects would come out like "Apple0", "Apple1", "Apple2"...So. Is this even possible to do (in a different way of course) in c# or ANY programming language?Thanks. 解决方案 这篇关于如何创建一个创建类的多个对象的循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-10 15:00