如何在ListViewItemCollections中使用
Linq在C#中选择ListViewItem?
新新200的X- 200 X- 200 200 X- 200 200 X- 200 200 X- 1992 200 X-
ListViewItemCollections lv = listview1.items; var test = from xxx in lv where xxx.text = "data 1" select xxx; test <--- Now has the listviewitem with "data 1" as string value..
解决方法
要获取ListViewItem的枚举器,您必须投射ListView的Items集合:
IEnumerable<ListViewItem> lv = listview1.items.Cast<ListViewItem>();
然后,您可以使用LINQ:
var test = from xxx in lv where xxx.text = "data 1" select xxx;
原文地址:https://www.jb51.cc/csharp/94139.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。