Exemple #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);
        }
Exemple #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));
        }
Exemple #3
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;
        }