I am using the code snippet below to parse a list of zip codes from a form and then building a predicate to return records from the Entity that match any zip codes in the parsed list.
List<string> zips = ParseCSV("90210,56387,20015");
predicate = predicate.And(n => zips.Contains(n.ZIP));
Now a new requirement has come up that says that the comma delimited list might contain partial zip codes and that these should be returned too. I would normally do this with a Contains. n.ZIP.Contains("902")
But if the list of zips now becomes as below:
List<string> zips = ParseCSV("902,56387,215");
predicate = predicate.And(n => zips.Contains(n.ZIP));
I am not sure how to go about this when I am already doing a contains on the zips. Any suggestions?
TIA
I think this will check if there is any partial zip code, which is contained in ZIP: