What I got is an address column with varchars in a database which looks like this:
Elmstreet / 12345 / USA
It contains Street, postal code and country. Unfortunately it's an existing database and I'm not allowed to make any changes there. So now I need a result set based on a list of postal codes.
The easiest way to get it is this:
string postalCode = "12345"; addresses = addresses.Where(x => x.Address.Contains(postalCode));
But as I have a list of postal codes I did this:
addresses = addresses.Where(x => postalCodes.Contains(x.Address));
But I don't get any results. And it's obvious after thinking about what the code does.
I was thinking of working with an additional list in which I would add the single results with a foreach loop through the postal code list.
But is there maybe an easier and better way to do that?
Thanks a lot.