A DateTime extension method that query if 'time' is time equal. - CSharp System

CSharp examples for System:DateTime Calculate

Description

A DateTime extension method that query if 'time' is time equal.

Demo Code

// Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
using System;//from  ww w. j  av  a  2 s  . c o  m

public class Main{
        /// <summary>
    ///     A DateTime extension method that query if 'time' is time equal.
    /// </summary>
    /// <param name="time">The time to act on.</param>
    /// <param name="timeToCompare">Date/Time of the time to compare.</param>
    /// <returns>true if time equal, false if not.</returns>
    public static bool IsTimeEqual(this DateTime time, DateTime timeToCompare)
    {
        return (time.TimeOfDay == timeToCompare.TimeOfDay);
    }
}

Related Tutorials