In
Returns true when a number is included in the specified collection.
Source
public static bool In(this int number, params int[] collection)
{
bool isIn = false;
foreach(var i in collection)
{
if(number == i)
{
isIn = true;
break;
}
}
return isIn;
}
Example
int a = SomePlace.A;
if(a.In(2, 4))
DoSomething();
else
DoSomethingElse();