Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在开始时初始化数组列表的列表?_C#_Windows_List - Fatal编程技术网

C# 如何在开始时初始化数组列表的列表?

C# 如何在开始时初始化数组列表的列表?,c#,windows,list,C#,Windows,List,我必须用C#写两份清单。第二个列表是什么? 第一种方法很好而且有效,第二种方法已经尝试过了,如下例所示,但不起作用。我希望它完全相同或相似,不使用其他变量 List<String> t = new List<string>() {"question","anotherQuestion"}; List t=newlist(){“问题”,“另一个问题”}; 那我要另一张单子 我想这样初始化它 List<String[]> t = new List<

我必须用C#写两份清单。第二个列表是什么? 第一种方法很好而且有效,第二种方法已经尝试过了,如下例所示,但不起作用。我希望它完全相同或相似,不使用其他变量

List<String> t = new List<string>()    {"question","anotherQuestion"};
List t=newlist(){“问题”,“另一个问题”};
那我要另一张单子

我想这样初始化它

List<String[]> t = new List<string[]>()  
{
   ("rightawnser","wrongAwnser"),  //1st question
   ("rightawnser","wrongAwnser"),  //2nd question

};
List t=新列表()
{
(“rightawnser”、“ErrorAwnser”),//第一个问题
(“rightawnser”,“errowrawnser”),//第二个问题
};

关闭,但必须为每个列表条目创建一个数组:

List<string[]> t = new List<string[]>()  
{
   new[] { "rightawnser","wrongAwnser" },  //1st question
   new[] { "rightawnser","wrongAwnser" },  //2nd question
};
List t=新列表()
{
新[]{“rightawnser”,“ErrorAwnser”},第1个问题
新[]{“rightawnser”,“ErrorAwnser”},第二个问题
};

似乎不是我想要的。谢谢。刚刚工作fine@HelderPereira没问题。请考虑接受帮助他人的答案,我很乐意,但我的名声不够吗?yet@HelderPereira如果你能提出问题,你就可以接受答案。我想这并不重要,对不起。你是对的。我不知道。我还没有许可证,还没有评分。