What's the syntax for searching a generic collection with more than 1 condition?

I need to search and see if there is a match in my generic collection with 4 constraints.  
myColleciton.Find(x => x.Name == users.GivenName);

How do I add on match requirements for last name, middle name...?
Thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lapuccaAuthor Commented:
I don't have to use that predicate syntax crap like x=>x......
not if you don't want to.

your constraintsahoul be in the colletion so either use strings (if you have strings that have the values you need)
or just use double quotes for the values you wan to match)
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

lapuccaAuthor Commented:
Go error when I put in just my 4 constraints, mouse over to see the error message.  Error says "No overload method for Find that takes 4 arguments.
for example if you were looking for metadata in a colletion like a keyword

C.KeywordTypes.Find("Account #")
käµfm³d 👽Commented:
Write it the same way you would an if block:


myColleciton.Find(x => x.Name == users.GivenName && x.MiddleName == users.MiddleName); 

Open in new window


myColleciton.Find(x => x.Name == users.GivenName || x.Name == "Joe"); 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:

Just keep in mind that the stuff on the left side of the arrow ( => ) is the variable declarations (with types optionally specified), and the stuff on the right is what will actually be executing.
lapuccaAuthor Commented:
I tried both with and without parentheses and both got me the same red underline error message.

                        users.Find(x => x.GivenName == gridEditUser.GivenName && x.Surname == gridEditUser.Surname && x.MiddleName == gridEditUser.MiddleName && x.VoiceTelephoneNumber = gridEditUser.VoiceTelephoneNumber);

                        users.Find(x => (x.GivenName == gridEditUser.GivenName) && (x.Surname == gridEditUser.Surname) && (x.MiddleName == gridEditUser.MiddleName) && (x.VoiceTelephoneNumber = gridEditUser.VoiceTelephoneNumber));

I'm using VS2012.  According to this link, http://stackoverflow.com/questions/12406750/find-item-in-generic-list-by-specifying-multiple-condition, it should work with either.  Can you see what's wrong with my code?  Thank you.
lapuccaAuthor Commented:
Found my typo, I'm missing a "=" at the last constraint.  Should be "==".  

Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.