Char - NotIn
A T extension method to determines whether the object is not equal to any of the provided values.
public static void Main() { char [] values = {'.','N','E','T','4','.','7','.','2'}; char input = 'F'; // C# Extension Method: Char - NotIn if(input.NotIn(values)) { Console.WriteLine("{0} doesn't exists in the array.", input); } }
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> /// ### /// <typeparam name="T">Generic type parameter.</typeparam> public static bool NotIn(this Char @this, params Char[] values) { return Array.IndexOf(values, @this) == -1; } }