gpt4 book ai didi

c# - 如何在 C# 中使用 List

转载 作者:行者123 更新时间:2023-11-30 19:06:16 24 4
gpt4 key购买 nike

下面的代码不想编译。我收到一条错误消息:

The best overloaded method match for 'System.Collections.Generic.List.Add(string[])has some invalid arguments

但是我看不出有什么问题。有什么建议吗?

public static List<string[]> ReadFromDelimitedFile (string Path)
{
int i=0;
List<string[]> AllContracts = new List<string[]>();
using (TextFieldParser parser = new TextFieldParser(Path))
{
parser.Delimiters = new string[] { "\t" };
while (true)
{
AllContracts.Add(i)= parser.ReadFields();
if (AllContracts.Add(i) == null)
{
break;
}
i++;

}
}

return AllContracts;
}

最佳答案

你想要:

AllContracts.Add(parser.ReadFields());

关于c# - 如何在 C# 中使用 List<string[]>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12606458/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com