如何将这种Var数据类型(myFilesList)中的项目添加到listView1中?
var myFilesList = allFiles.Select(f =>
{
using (var fs = new FileStream(f, FileMode.Open, FileAccess.Read))
{
return new
{
FileName = f,
FileHash = BitConverter.ToString(SHA1.Create().ComputeHash(fs))
};
}
}).GroupBy(f => f.FileHash).Select(g => new { FileHash = g.Key, Files = g.Select(z => z.FileName).ToList() })
.SelectMany(f => f.Files.Skip(1)).ToList();
答案 0 :(得分:0)
尝试
foreach (var item in myFilesList )
{
ListViewItem item1 = new ListViewItem(item.your desired property);
ListView1.Items.AddRange(item1);
}
希望有帮助