如何从WPF中的Observable集合除以每个值 [英] How to divide each value from the Observable collection in wpf

查看:265
本文介绍了如何从WPF中的Observable集合除以每个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可观察的集合对象,我想知道将值除以检查特定值是否存在.


私有ObservableCollection<支付实体> BuildingList = new ObservableCollection< paymententity>();

i have a observable collection object, i wanna know about the divide the value to check the particular value is there or not.


private ObservableCollection<paymententity> BuildingList = new ObservableCollection<paymententity>();

推荐答案

您可以在集合中搜索值.
使用LINQ-> BuildingList.where(x => x.myProp == ''abc'');
You can search for values within a collection.
Using LINQ -> BuildingList.where(x => x.myProp == ''abc'');


我只是将Enitity值放入可观察的集合 BuildingList 中,然后通过特定值过滤这些值,然后将其添加到另一个可观察的集合 BuildingList1

i just Enitity values into observable collection BuildingList then that values are filter through particular value and then add into another observable collection BuildingList1

ObservableCollection<paymententity> BuildingList1=new Obsevable Collection();
public void fillBuilding(int _locationId)
          {
              BuildingList1.Clear();
              foreach (var item in BuildingList)
              {
                  if (item.LocationId == _locationId)
                  {
                      BuildingList1.Add(item);
                  }
              }


这篇关于如何从WPF中的Observable集合除以每个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆