C# C使用foreach打开选定的listview项
应该在哪里??? 我想在我的简单文件资源管理器中打开例如3个选定的文件C# C使用foreach打开选定的listview项,c#,listview,foreach,C#,Listview,Foreach,应该在哪里??? 我想在我的简单文件资源管理器中打开例如3个选定的文件 private void Open_Click(object sender, System.EventArgs e) { foreach (???) { string ImageViewName = listView1.SelectedItems[0].Text; System.Diagnostics.Process.Start(@t
private void Open_Click(object sender, System.EventArgs e)
{
foreach (???)
{
string ImageViewName = listView1.SelectedItems[0].Text;
System.Diagnostics.Process.Start(@textBox1.Text.Remove(3, 1) + "/" + ImageViewName);
}
}
textbox1中是我的文件路径假设每个文件都在名为文件的列表中
foreach (File myFile in Files){
//Do something with myFile
}
foreach块将遍历文件中的每个文件。当前选定的文件(可从foreach块中访问)在此实例中称为“myFile”
我是stackoverflow的新手,所以我也愿意接受关于我答案的建议 例如,在mySimpleExplorerInstance.files.Whereo=>o.IsSelected.Take3{…}中的MySimpleFileExplorer-foreachvar文件中打开3个选定文件