Пример #1
0
        /// <summary>Initializes an instance of the <see cref="MonthYearPart"/> structure.</summary>
        /// <param name="month">The month number (1 - 12).</param>
        /// <param name="year">The year.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="month"/> is less than 1 or greater than 12.
        /// <para>-or-</para>
        /// <paramref name="year"/> is less than 1 or greater than 9999.
        /// </exception>
        public MonthYearPart(int month, int year)
        {
            DateVerification.ValidateMonth(month, "month");
            DateVerification.ValidateYear(year, "year");

            m_value = (month & 0x000000FF) << 16 | (year & 0xFFFF);
        }
Пример #2
0
        /// <summary>Gets a month and year part for a date.</summary>
        /// <param name="year">The year.</param>
        /// <returns>The month and year part.</returns>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="year"/> is less than 1 or greater than 9999.</exception>
        public MonthYearPart OfYear(int year)
        {
            DateVerification.ValidateYear(year, "year");

            return(new MonthYearPart(Month, year));
        }
Пример #3
0
        /// <summary>Gets a month of the year.</summary>
        /// <param name="value">The month.</param>
        /// <returns>The month and year part.</returns>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than 1 or greater than 12.</exception>
        public MonthYearPart Month(int value)
        {
            DateVerification.ValidateMonth(value, "value");

            return(new MonthYearPart(value, Year));
        }
Пример #4
0
        /// <summary>Initializes an instance of the <see cref="MonthPart"/> structure.</summary>
        /// <param name="month">The month (1 - 12).</param>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="month"/> is less than 1 or greater than 12.</exception>
        public MonthPart(int month)
        {
            DateVerification.ValidateMonth(month, "month");

            m_month = month;
        }
Пример #5
0
        /// <summary>Initializes an instance of the <see cref="YearPart"/> structure.</summary>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="year"/> is less than 1 or greater than 9999.</exception>
        public YearPart(int year)
        {
            DateVerification.ValidateYear(year, "year");

            m_value = year;
        }