如何在c#中动态创建n个数组?
首先我会问用户“您想输入多少个名字?”。 一旦他们进入,我想创建那个数量的数组。 如何在c#中动态创建n个数组?
Console.WriteLine("How many names you want to Enter?");
int nameCount = Convert.ToInt32(console.Readline());
//I know following code is not possible.But How to make it possible?
for(int i=1;i<=nameCount;i++)
{
string[] name+i = new string[45];
//what I mean is string[] name1 = new string[45];
string[] name+i = new string[45];
string[] name+i = new string[45];
string[] name+i = new string[45];
.
.
.
}
First I will ask users "How many names you want to enter?".
Once they have entered,I wanted to create that number of arrays.
How to create n number of Arrays Dynamically in c#?
Console.WriteLine("How many names you want to Enter?");
int nameCount = Convert.ToInt32(console.Readline());
//I know following code is not possible.But How to make it possible?
for(int i=1;i<=nameCount;i++)
{
string[] name+i = new string[45];
//what I mean is string[] name1 = new string[45];
string[] name+i = new string[45];
string[] name+i = new string[45];
string[] name+i = new string[45];
.
.
.
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
List
或者
Try
List<string[]>
Or