How about:
if (new[] {1, 2}.Contains(value))
It’s a hack though 🙂
Or if you don’t mind creating your own extension method, you can create the following:
public static bool In<T>(this T obj, params T[] args)
{
return args.Contains(obj);
}
And you can use it like this:
if (1.In(1, 2))
🙂