Cast ListView Items to List<string>?
问题 How can I cast ListView.Items to a List<string> ? This is what I tried: List<string> list = lvFiles.Items.Cast<string>().ToList(); but I received this error: Unable to cast object of type 'System.Windows.Forms.ListViewItem' to type 'System.String'. 回答1: A ListViewItemCollection is exactly what it sounds like - a collection of ListViewItem elements. It's not a collection of strings. Your code fails at execution time for the same reason that this code would fail at compile time: ListViewItem