3
Answers

List generic search criteria .. are predicates helpful?

Sri

Sri

16y
5.6k
1

OK heres the catch I have. There is this our very famous employee class with some first name, last name and middle initial. I enter a value in a new Web combo control (Infragistics) well if you dont know what that is then think of a textbox control. All I am trying to do is to filter the list of employee objects based on the text entered and return the new list of filtered employees.

I have seen into predicates and using the delegates to mention the search criteria but the bad part is that my search criteria is not within my object.. I hate to send that search string as a part of my employee object.. and I would probably shout at people who suggest that..

So how do we mention our search criteria not within the object of the list which is being searched for..

My last alternative is using a enumerator to go through each of the list members and compare the search. It would be great if someone can point me to an article or method that can do this for me before I get into brute force. Please help before I write unhealthy code..

Thanks

Sri

Answers (3)