Beispiel #1
0
 public static void FirstDayOfYear(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg != arg.FirstDayOfYear())
     {
         throw DateTimeCodeExceptions.ArgumentNotFirstDayOfYear(argName, arg);
     }
 }
Beispiel #2
0
 public static void DateOnly(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg.TimeOfDay > TimeSpan.Zero)
     {
         throw DateTimeCodeExceptions.ArgumentWithTime(argName, arg);
     }
 }
Beispiel #3
0
 public static void IsUtc(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg.Kind != DateTimeKind.Utc)
     {
         throw DateTimeCodeExceptions.ArgumentNotUtc(argName, arg);
     }
 }
Beispiel #4
0
 public static void LastDayOfMonth(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg != arg.LastDayOfMonth())
     {
         throw DateTimeCodeExceptions.ArgumentNotLastDayOfMonth(argName, arg);
     }
 }
 public static void FirstDayOfMonth(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (arg != arg.FirstDayOfMonth())
     {
         throw DateTimeCodeExceptions.ArgumentNotFirstDayOfMonth(argName, arg);
     }
 }
 public static void IsUtc(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (!arg.IsUtc())
     {
         throw DateTimeCodeExceptions.ArgumentNotUtc(argName, arg);
     }
 }
 public static void LastDayOfYear(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (arg != arg.LastDayOfYear())
     {
         throw DateTimeCodeExceptions.ArgumentNotLastDayOfYear(argName, arg);
     }
 }
 public static void IsUtcAndDateOnly(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (!arg.IsUtc())
     {
         throw DateTimeCodeExceptions.ArgumentNotUtc(argName, arg);
     }
     if (arg.TimeOfDay > TimeSpan.Zero)
     {
         throw DateTimeCodeExceptions.ArgumentWithTime(argName, arg);
     }
 }