Пример #1
0
 public static void FirstDayOfYear(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg != arg.FirstDayOfYear())
     {
         throw DateTimeCodeExceptions.ArgumentNotFirstDayOfYear(argName, arg);
     }
 }
Пример #2
0
 public static void DateOnly(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg.TimeOfDay > TimeSpan.Zero)
     {
         throw DateTimeCodeExceptions.ArgumentWithTime(argName, arg);
     }
 }
Пример #3
0
 public static void IsUtc(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg.Kind != DateTimeKind.Utc)
     {
         throw DateTimeCodeExceptions.ArgumentNotUtc(argName, arg);
     }
 }
Пример #4
0
 public static void LastDayOfMonth(
     DateTime arg,
     [InvokerParameterName] string argName)
 {
     if (arg != arg.LastDayOfMonth())
     {
         throw DateTimeCodeExceptions.ArgumentNotLastDayOfMonth(argName, arg);
     }
 }
Пример #5
0
 public static void FirstDayOfMonth(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (arg != arg.FirstDayOfMonth())
     {
         throw DateTimeCodeExceptions.ArgumentNotFirstDayOfMonth(argName, arg);
     }
 }
Пример #6
0
 public static void IsUtc(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (!arg.IsUtc())
     {
         throw DateTimeCodeExceptions.ArgumentNotUtc(argName, arg);
     }
 }
Пример #7
0
 public static void LastDayOfYear(
     DateTimeOffset arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (arg != arg.LastDayOfYear())
     {
         throw DateTimeCodeExceptions.ArgumentNotLastDayOfYear(argName, arg);
     }
 }
Пример #8
0
 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);
     }
 }