In

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();

Description

Returns true when a number is included in the specified collection.

Details

Double click on the code to select all.

 

;