Enum - NotIn

A T extension method to determines whether the object is not equal to any of the provided values.

Try it

private static void Display(Color color)
{
    // C# Extension Method: Enum - NotIn
    if (color.NotIn(Color.DarkSeaGreen, Color.RosyBrown, Color.RosyBrown))
    {
        Console.WriteLine("{0} doesn't exists in the list.", color);
    }
    else
    {
        Console.WriteLine("{0} exists in the list.", color);
    }
}

public static void Main()
{
    Display(Color.BlanchedAlmond);
    Display(Color.RosyBrown);
}

}

public enum Color
{
[Description("Blanched Almond Color")]
BlanchedAlmond = 1,
[Description("Dark Sea Green Color")]
DarkSeaGreen = 2,
[Description("Deep Sky Blue Color")]
DeepSkyBlue = 3,
[Description("Rosy Brown Color")]
RosyBrown = 4

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     A T extension method to determines whether the object is not equal to any of the provided values.
    /// </summary>
    /// <param name="this">The object to be compared.</param>
    /// <param name="values">The value list to compare with the object.</param>
    /// <returns>true if the values list doesn't contains the object, else false.</returns>
    public static bool NotIn(this Enum @this, params Enum[] values)
    {
        return Array.IndexOf(values, @this) == -1;
    }
}