开发者

ObservableCollection<MyCustomClass>.Contains(MyCustomObject.SomeProperty)

开发者 https://www.devze.com 2023-01-12 04:46 出处:网络
How can I extend 开发者_Python百科(or overload) Contains method with some custom property in a collection ?

How can I extend 开发者_Python百科(or overload) Contains method with some custom property in a collection ?

I want that delegate to compare the object with just a property of it and returns true if there is an object with the same value of a property.


return myCollection.Any(myCustomObject => myCustomObject.SomeProperty.Equals(valueToFind));
0

精彩评论

暂无评论...
验证码 换一张
取 消