A DateTime extension method that query if '@this' is in the past. - CSharp System

CSharp examples for System:DateTime Calculate

Description

A DateTime extension method that query if '@this' is in the past.

Demo Code

// Copyright (c) 2015 ZZZ Projects. All rights reserved
using System;//  w  w w .  j  av  a 2  s . co m

public class Main{
        /// <summary>
    ///     A DateTime extension method that query if '@this' is in the past.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>true if the value is in the past, false if not.</returns>
    public static bool IsPast(this DateTime @this)
    {
        return @this < DateTime.Now;
    }
}

Related Tutorials