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

CSharp examples for System:DateTime Calculate

Description

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

Demo Code

// Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
using System;/* w  w  w . java 2 s .  c o m*/

public class Main{
        /// <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 DateTime @this, params DateTime[] values)
    {
        return Array.IndexOf(values, @this) == -1;
    }
}

Related Tutorials