Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lambda Expressions with multiple search criteria

Tags:

vb.net

lambda

Currently I am searching through my list to find Customers that match on Address. I need to match on both address and city. How do I rewrite my lambda Expression to match both criteria?

CustomerList.FindAll(Function(c) c.Address = addressToMatch)

like image 773
Princess Avatar asked Dec 01 '25 05:12

Princess


1 Answers

The keyword you are looking for is AndAlso. It combines two separate checks into a single one which evaluates to True iff both components are also True

CustomerList.FindAll(Function(c) c.Address = addressToMatch AndAlso c.City = cityToMatch)
like image 135
JaredPar Avatar answered Dec 03 '25 22:12

JaredPar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!