我试图将大量的数据加载到listView。下面的代码正在工作,但我想创建一个列表视图项目的数组,然后将此数组添加到我的列表视图。有没有人可以告诉我该怎么做?使用数组填充ListView
using (var csv = new CsvReader(new StreamReader(openFileDialog1.FileName), true))
{
int fieldCount = csv.FieldCount;
string[] headers = csv.GetFieldHeaders();
int i = 0;
while (csv.ReadNextRecord())
{
this.listView1.Items.Add(
new ListViewItem(new[] { csv[0], csv[1], csv[2], csv[3], csv[4] })
);
}
}
什么是“问题”? – user2864740