In
Determines whether a IEnumerable<T> contains a specific value
Source
public static bool In<T>(this T value, IEnumerable<T> values)
{
if(values == null)
throw new ArgumentNullException("values");
return values.Contains(value);
}
Example
int[] numbers = {1, 2, 3, 4 };
int a = 3;
if(a.In(numbers))
{ ... }