"在声明之前不能使用局部变量'csv'


List<Zip> zipCodes = new List<Zip>();
void WriteToCsv(List<Zip> zipCodes)
{
using (var writer = new StreamWriter("CurrentData.csv"))
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)
{
csv.WriteRecords(zipCodes);
}
}

csv。WriteRecords函数是什么给我的错误。我没有在上面声明吗?

缺少右括号)在CSV的末尾使用block

一样:

using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
csv.WriteRecords(zipCodes);
}

using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)

你少了一个')'

相关内容

  • 没有找到相关文章

最新更新