I have a IList<Customer> and I want to find a customer whose lastname=’smith’. how do i do that? The .where looks like it might work but I don’t understand the predicate needed to do this. Or is there a better way to search the list?
Thanks,
rod.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want the first customer which his last name is ‘smith’, use
FirstOrDefaultAnd If you want all the customers which their last name is ‘smith’, use
Where:Good luck!