I know this is old, but I thought it would help new readers of this post.
Like code4life , I use an extension method. The difference, however, is that I use generics, so this will work with several types.
You can read my post to find out more about how to do this, but the basic idea is this:
By adding this extension method to your code:
public static bool IsIn<T>(this T source, params T[] values) { return values.Contains(source); }
you can search as follows:
var a = Members.Where(x => x.City.IsIn("Chicago", "NewYork");
It works on any type (as long as you create a good equals method). Any type of value for sure.
Gabriel McAdams
source share