I have a collection being returned by a web service. A property of this collection is \"StatusCode\" which is a string value that can be anywhere from 0 to 5 (don\'t ask me why
I recently wrote a blog post about a method using extension methods and params.
By adding this extension method to your code:
public static bool IsIn(this T source, params T[] values)
{
return values.Contains(source);
}
you can perform your search like this:
var wo = from w in workOrders
where w.StatusCode.IsIn("0", "1", "2")
select w;
It works on any type (as long as you create a good equals method). Any value type for sure.