In

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))
{ ... }

Description

Determines whether a IEnumerable<T> contains a specific value

Details

Double click on the code to select all.

 

;