I use an extension method:
using System.Linq;
...
public static bool In<T>(this T item, params T[] list)
{
return list.Contains(item);
}
...
if (!x.In(2,3,61,71))
...
You can rename it to IsElementOf
if you prefer this name…
I use an extension method:
using System.Linq;
...
public static bool In<T>(this T item, params T[] list)
{
return list.Contains(item);
}
...
if (!x.In(2,3,61,71))
...
You can rename it to IsElementOf
if you prefer this name…