我需要用double foreach来填充带有versioninfo prellevato值的数据网格。
incorro错误:
FileVersionInfo.GetVersionInfo (file)
; (语法不正确)
DirectoryInfo dir = new DirectoryInfo(@"D:\TEMP\");
foreach (DirectoryInfo folder in dir.GetDirectories())
{
foreach (FileInfo file in folder.GetFiles())
{
FileVersionInfo verInfo = FileVersionInfo.GetVersionInfo(file);
dataGridView1.ColumnCount = 1;
dataGridView1.Columns[0].Name = "Version";
string[] row = new string[] { verInfo.ProductVersion };
dataGridView1.Rows.Add(row);
}
}
答案 0 :(得分:0)
正如BugFinder已经向您指出了方法FileVersionInfo.GetVersionInfo
的文档只需string
作为参数。所以你应该给它文件名,而不是FileInfo
FileVersionInfo verInfo = FileVersionInfo.GetVersionInfo(file.FullName);