ListBox.ObjectCollection 类 :http://msdn.microsoft.com/zh-cn/library/system.windows.forms.listbox.objectcollection.aspxpublic class ObjectCollection : IList, ICollection, IEnumerable不是写了ObjectCollection实现了IEnumerable接口的吗?
那为什么不能用Where方法
listBox20.Items.Where(x =>.....) //为什么不能用?
那为什么不能用Where方法
listBox20.Items.Where(x =>.....) //为什么不能用?
要泛型的 IEnumerable 接口才扩展出 Where 方法
要想支持LINQ,必须转换成IEnumerable<T>,使用Cast<T>()、OfType<T>()方法。或者自行foreach转换为IEnumerable<T>。