LIST的Find()和Sort()方法 [英] Find() and Sort() methods of LIST

查看:109
本文介绍了LIST的Find()和Sort()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我想使用 LIST<的 Find() Sort()方法; T> ,但我不知道如何.
我可以使用查找方法在 LIST 中查找具有特定属性的对象吗? (我已经声明了对象的 LIST )

Hi I want to use Find() and Sort() methods of LIST< T > , but I don''t know how.
Can I use Find method for finding an object in LIST which has a specific Property? (I''ve declared a LIST of my objects)

推荐答案

是的,将其传递给谓词,以检查该属性以查看其是否是一场比赛.或者,如果要查找实际属性而不是其值,则可以在对象(谓词中)上使用反射来检查该属性是否存在.
Yes, pass it a predicate that checks the property to see if it is a match. Or, if you are looking for the actual property rather than its value, you can use reflection on the objects (in the predicate) to check if that property exists.


这篇关于LIST的Find()和Sort()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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