In
Allows you to compare a value to a list of values analogous to the 'In' statement in sql. This makes for a very friendly syntax that is (IMHO) superior to a list of 'or' clauses. Instead of : if (s=="John" || s=="Peter" or s=="Paul") one can write if (s.In("John","Paul","Peter"))
Source
public static bool In<T>(this T source,params T[] list)
{
return list.ToList().Contains(source);
}
Example
string s="John";
if (s.In("John","Paul","Peter"))
{
Debug.WriteLine("Are you an apostle?");
}