Is DateTime Not In The Past - CSharp System

CSharp examples for System:DateTime

Description

Is DateTime Not In The Past

Demo Code


using System.Text.RegularExpressions;
using System;/*from   ww  w.  ja v  a 2s.  co m*/

public class Main{
        public static void IsNotInThePast(DateTime param, string name)
        {
            if (param < DateTime.UtcNow) throw new ArgumentOutOfRangeException(name, String.Format("{0} cannot be in the past", name));
        }
}

Related Tutorials