当前位置: 首页>>代码示例>>C#>>正文


C# GregorianCalendar.GetMonthsInYear方法代码示例

本文整理汇总了C#中System.Globalization.GregorianCalendar.GetMonthsInYear方法的典型用法代码示例。如果您正苦于以下问题:C# GregorianCalendar.GetMonthsInYear方法的具体用法?C# GregorianCalendar.GetMonthsInYear怎么用?C# GregorianCalendar.GetMonthsInYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Globalization.GregorianCalendar的用法示例。


在下文中一共展示了GregorianCalendar.GetMonthsInYear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WorkYear

        public WorkYear(int year, WorkDayParserSettings parserSettings, int hitListLookBackInWeeks, float hoursPerDay, PNSearchViewModel pnSearch, PositionSearchViewModel positionSearch)
        {
            this.hitListLookBackInWeeks = hitListLookBackInWeeks;
            this.pnSearch = pnSearch;
            this.positionSearch = positionSearch;
            this.Year = year;
            this.Months = new ObservableCollection<WorkMonth>();
            this.Weeks = new ObservableCollection<WorkWeek>();

            var germanSpecialDays = SpecialDaysUtils.GetGermanSpecialDays(year);

            var cal = new GregorianCalendar();
            for (int month = 1; month <= cal.GetMonthsInYear(year); month++)
            {
                WorkMonth wm = new WorkMonth(year, month, germanSpecialDays, parserSettings, hoursPerDay);
                this.Months.Add(wm);
                foreach (var workWeek in wm.Weeks)
                {
                    this.Weeks.Add(workWeek);
                    workWeek.PropertyChanged += this.workWeek_PropertyChanged;
                }
            }
            this.ProjectHitlist = new QuickFillObservableCollection<HitlistInfo>();
            this.PositionHitlist = new QuickFillObservableCollection<HitlistInfo>();
            this.UpdateProjectHitlistAsync();
            this.UpdatePositionHitlistAsync();
        }
开发者ID:dotob,项目名称:moni,代码行数:27,代码来源:WorkYear.cs

示例2: PosTest3

 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(2004, 2, 29, 0, 0, 0, 0);
     int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetMonthsInYear.cs

示例3: PosTest2

 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc);
     int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetMonthsInYear.cs

示例4: PosTest5

 public void PosTest5()
 {
     int era = c_AD_ERA;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year;
     int expectedMonths, actualMonths;
     year = GetAYear(myCalendar);
     expectedMonths = c_MONTHS_IN_YEAR;
     actualMonths = myCalendar.GetMonthsInYear(year, era);
     Assert.Equal(expectedMonths, actualMonths);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:GregorianCalendarGetMonthsInYear.cs

示例5: WorkYear

        public WorkYear(int year, IEnumerable<ShortCut> shortCuts, int hitListLookBackInWeeks, float hoursPerDay, PNSearchViewModel pnSearch, PositionSearchViewModel positionSearch)
        {
            this.hitListLookBackInWeeks = hitListLookBackInWeeks;
              this.pnSearch = pnSearch;
              this.positionSearch = positionSearch;
              this.Year = year;
              this.Months = new ObservableCollection<WorkMonth>();
              this.Weeks = new ObservableCollection<WorkWeek>();

              var germanSpecialDays = SpecialDaysUtils.GetGermanSpecialDays(year);

              var cal = new GregorianCalendar();
              for (int month = 1; month <= cal.GetMonthsInYear(year); month++) {
            WorkMonth wm = new WorkMonth(year, month, germanSpecialDays, shortCuts, hoursPerDay);
            this.Months.Add(wm);
            foreach (var workWeek in wm.Weeks) {
              this.Weeks.Add(workWeek);
              workWeek.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.workWeek_PropertyChanged);
            }
              }
        }
开发者ID:vipwolf,项目名称:moni,代码行数:21,代码来源:WorkYear.cs

示例6: NegTest5

 public void NegTest5()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, era;
     year = GetAYear(myCalendar);
     era = 3;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.GetMonthsInYear(year, era);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:GregorianCalendarGetMonthsInYear.cs

示例7: NegTest4

 public void NegTest4()
 {
     int era = c_CURRENT_ERA;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year;
     year = myCalendar.MinSupportedDateTime.Year - 100;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.GetMonthsInYear(year, era);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:GregorianCalendarGetMonthsInYear.cs

示例8: PosTest10

 public void PosTest10()
 {
     int era = c_CURRENT_ERA;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year;
     int expectedMonths, actualMonths;
     year = myCalendar.MinSupportedDateTime.Year;
     expectedMonths = c_MONTHS_IN_YEAR;
     actualMonths = myCalendar.GetMonthsInYear(year, era);
     Assert.Equal(expectedMonths, actualMonths);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:GregorianCalendarGetMonthsInYear.cs


注:本文中的System.Globalization.GregorianCalendar.GetMonthsInYear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。