コード例 #1
0
ファイル: LocalDate.cs プロジェクト: wase932/nodatime
 /// <summary>
 /// Constructs an instance for the given year, month and day in the specified calendar.
 /// </summary>
 /// <param name="year">The year. This is the "absolute year", so, for
 /// the ISO calendar, a value of 0 means 1 BC, for example.</param>
 /// <param name="month">The month of year.</param>
 /// <param name="day">The day of month.</param>
 /// <param name="calendar">Calendar system in which to create the date.</param>
 /// <returns>The resulting date.</returns>
 /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid date.</exception>
 public LocalDate(int year, int month, int day, [NotNull] CalendarSystem calendar)
 {
     Preconditions.CheckNotNull(calendar, nameof(calendar));
     calendar.ValidateYearMonthDay(year, month, day);
     yearMonthDayCalendar = new YearMonthDayCalendar(year, month, day, calendar.Ordinal);
 }
コード例 #2
0
 /// <summary>
 /// Constructs an instance for the given year, month and day in the specified calendar.
 /// </summary>
 /// <param name="year">The year. This is the "absolute year", so, for
 /// the ISO calendar, a value of 0 means 1 BC, for example.</param>
 /// <param name="month">The month of year.</param>
 /// <param name="calendar">Calendar system in which to create the year/month.</param>
 /// <returns>The resulting year/month.</returns>
 /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid year/month.</exception>
 public YearMonth(int year, int month, CalendarSystem calendar)
 {
     Preconditions.CheckNotNull(calendar, nameof(calendar));
     calendar.ValidateYearMonthDay(year, month, 1);
     startOfMonth = new YearMonthDayCalendar(year, month, 1, calendar.Ordinal);
 }