从 Observable 集合中,我想过滤名称为 aaa、bbb、ccc、ddd、eee 的项目。这该怎么做?
public class Item
{
public string ItemName {get; set;}
public int ItemNumber {get; set;}
}
public ObservableCollection<Item> _items;
public List<string> searchItems = new List<string>(5);
searchItems.Add("aaa");
searchItems.Add("bbb");
searchItems.Add("ccc");
searchItems.Add("ddd");
searchItems.Add("eee");
我在 linq 中尝试了一些 .. 但我不知道如何处理列表..
var filteredItems = from item in _items
where _items.Any(x => x.ItemName == "aaa")
select x;