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


C# Month类代码示例

本文整理汇总了C#中Month的典型用法代码示例。如果您正苦于以下问题:C# Month类的具体用法?C# Month怎么用?C# Month使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetRandomRain

 private Rain GetRandomRain(Month month, Cloudiness cloudiness) {
     double fraction = random.NextDouble();
     switch(month) {
         case Month.January:
         case Month.February:
         case Month.December:
             if(fraction < 0.05 && cloudiness != Cloudiness.Low)
                 return Rain.Heavy;
             else if(fraction < 0.2)
                 return Rain.Drizzle;
             else
                 return Rain.None;
         case Month.July:
         case Month.August:
             if(fraction < 0.05 && cloudiness != Cloudiness.Low)
                 return Rain.Thunderstorm;
             else if(fraction < 0.1)
                 return Rain.Heavy;
             else if(fraction < 0.3)
                 return Rain.Drizzle;
             else
                 return Rain.None;
         default:
             if(fraction < 0.01 && cloudiness != Cloudiness.Low)
                 return Rain.Thunderstorm;
             else if(fraction < 0.03)
                 return Rain.Heavy;
             else if(fraction < 0.1)
                 return Rain.Drizzle;
             else
                 return Rain.None;
     }
 }
开发者ID:vebin,项目名称:soa,代码行数:33,代码来源:WeatherForecast.cs

示例2: MonthRange

 public MonthRange(Month startMonth, int startYear, Month endMonth, int endYear)
 {
     StartYear = startYear;
     StartMonth = (int)startMonth;
     EndMonth = (int)endMonth;
     EndYear = endYear;
 }
开发者ID:mickdelaney,项目名称:Infrastructure,代码行数:7,代码来源:MonthRange.cs

示例3: Quarter

 /// <summary>
 /// Returns quarter date is in based on specifed
 /// start of year
 /// </summary>
 /// <param name="aDate"></param>
 /// <param name="startOfQuarter">Start of the year</param>
 /// <returns></returns>
 public static Quarter Quarter(this System.DateTime aDate, Month startOfYear)
 {
     int offset;
     offset = (((int)startOfYear -1) * -1) + aDate.Month;
     if(offset <= 0) offset = 12 - (Math.Abs(offset));
     return (Quarter)Math.Ceiling((double)((offset) / 3M));
 }
开发者ID:barake,项目名称:TemporalToolkit,代码行数:14,代码来源:DateExtensions.cs

示例4: LocalDate

        /// <summary>
        /// Creates a new LocalDate with the given year, month and day.
        /// </summary>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <param name="day"></param>
        public LocalDate(int year, Month month, int day)
        {
            int monthNumber = month.Number();

            if (monthNumber < 1 || monthNumber > 12)
            {
                throw new ArgumentOutOfRangeException("month", "invalid month with number " + ((int)month));
            }

            if (day < 1)
            {
                throw new ArgumentOutOfRangeException("day", "day must be at least 1");
            }

            int monthLength = month.Length(DateTime.IsLeapYear(year));

            if (day > monthLength)
            {
                throw new ArgumentOutOfRangeException("day", month.Name() + " " + year + " has only " + monthLength + " days");
            }

            m_year = year;
            m_month = month;
            m_day = day;
        }
开发者ID:spiegelp,项目名称:PortableTimeLibrary,代码行数:31,代码来源:LocalDate.cs

示例5: GetMonthlyPrintNumber

 public static int GetMonthlyPrintNumber(Date date, int refNumber, Date refDate, Month noPrintMonths, Dictionary<int, int> noPrintDates, Dictionary<int, int> noPrintNumbers)
 {
     int no = refNumber;
     Date date2 = refDate;
     while (date > date2)
     {
         date2 = date2.AddMonths(1);
         Month month = zdate.GetMonth(date2.Month);
         if ((noPrintMonths & month) != month && !noPrintDates.ContainsKey(date2.AbsoluteDay))
         {
             do
             {
                 no++;
             } while (noPrintNumbers.ContainsKey(no));
         }
     }
     while (date < date2)
     {
         Month month = zdate.GetMonth(date2.Month);
         if ((noPrintMonths & month) != month && !noPrintDates.ContainsKey(date2.AbsoluteDay))
         {
             do
             {
                 no--;
             } while (noPrintNumbers.ContainsKey(no));
         }
         date2 = date2.AddMonths(-1);
     }
     return no;
 }
开发者ID:labeuze,项目名称:source,代码行数:30,代码来源:zprint.cs

示例6: DayOfWeekAnnualReccurance

 public DayOfWeekAnnualReccurance(DayOfWeek dayOfWeek, WeekOfMonth week, Month month, bool substituteWeekend = true)
     : base(substituteWeekend)
 {
     DayOfWeek = dayOfWeek;
     Week = week;
     Month = month;
 }
开发者ID:BishoyDemian,项目名称:BusinessDayCounting,代码行数:7,代码来源:DayOfWeekAnnualReccurance.cs

示例7: op_ToMonth_string

        public void op_ToMonth_string()
        {
            var expected = new Month(2010, 11);
            var actual = "2010-11".ToMonth();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Temporal.ExtensionMethods.Facts.cs

示例8: CalendarDay

 public CalendarDay(DayOfWeek dayOfWeek, int year, Month month, int dayOfMonth)
 {
     DayOfWeek = dayOfWeek;
     Year = year;
     Month = month;
     DayOfMonth = dayOfMonth;
 }
开发者ID:pedroliska,项目名称:relue,代码行数:7,代码来源:Problem019.cs

示例9: Gregorian

 public Gregorian(ITimeContext context, int year, Month month, int day, int hour = 0, int minute = 0, int second = 0, int milliseconds = 0, TimeZone timezone = null)
 {
     if (timezone == null)
         timezone = context.Gmt ();
     this.timezone = timezone;
     //TODO: Validate input
     this.time = new DateTime (year, (int)month, day, hour, minute, second, milliseconds, System.DateTimeKind.Utc).ToTime (context);
 }
开发者ID:jarlrasm,项目名称:JarlTime,代码行数:8,代码来源:Gregorian.cs

示例10: CalculatePTServiceCommission

 public void CalculatePTServiceCommission(int aEmployeeID, string aBranchCode, Month aMonth, int aYear)
 {
     nEmployeeID = aEmployeeID;
     strBranchCode = aBranchCode;
     month = aMonth;
     year = aYear;
     ProcessCalculation();
 }
开发者ID:kimykunjun,项目名称:test,代码行数:8,代码来源:CommissionPTService.cs

示例11: GetLateness

 public void GetLateness(int nEmployeeID, Month aMonth, int aYear)
 {
     this.nEmployeeID = nEmployeeID;
     Ultis.DatesRange(out startDate, out endDate, aMonth, aYear);
     GetLatenessData();
     GenerateLatenessTable();
     CalculateLateness();
 }
开发者ID:kimykunjun,项目名称:test,代码行数:8,代码来源:Lateness.cs

示例12: AdvanceMonth

 public void AdvanceMonth()
 {
     this.month++;
     if (this.month == Month.December + 1)
     {
         this.month = Month.January;
         this.year++;
     }
 }
开发者ID:IvayloDonchev,项目名称:StructsAndEnums,代码行数:9,代码来源:Date.cs

示例13: YearlyPattern

 /// <summary>
 /// Initializes a new instance of the <see cref="YearlyPattern"/> class.
 /// </summary>
 /// <param name="startDate">The date and time when the recurrence starts.</param>
 /// <param name="month">The month of the year each occurrence happens.</param>
 /// <param name="dayOfMonth">The day of the month each occurrence happens.</param>
 public YearlyPattern(
     DateTime startDate,
     Month month,
     int dayOfMonth)
     : base(startDate)
 {
     this.Month = month;
     this.DayOfMonth = dayOfMonth;
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:15,代码来源:Recurrence.YearlyPattern.cs

示例14: NewGameInfo

 /// <summary>
 ///     Initializes a new instance of the <see cref="T:OregonTrailDotNet.Window.MainMenu.NewGameInfo" /> class.
 /// </summary>
 public NewGameInfo()
 {
     PlayerNameIndex = 0;
     _playerNames = new List<string>();
     _playerProfession = Entity.Person.Profession.Banker;
     _startingInventory = new List<SimItem>();
     _startingMonies = 0;
     _startingMonth = Month.March;
     Modified = false;
 }
开发者ID:Maxwolf,项目名称:OregonTrail,代码行数:13,代码来源:NewGameInfo.cs

示例15: TimeChangeRecurrence

 /// <summary>
 /// Initializes a new instance of the <see cref="TimeChangeRecurrence"/> class.
 /// </summary>
 /// <param name="dayOfTheWeekIndex">The index of the day in the month at which the time change occurs.</param>
 /// <param name="dayOfTheWeek">The day of the week the time change occurs.</param>
 /// <param name="month">The month the time change occurs.</param>
 public TimeChangeRecurrence(
     DayOfTheWeekIndex dayOfTheWeekIndex,
     DayOfTheWeek dayOfTheWeek,
     Month month)
     : this()
 {
     this.dayOfTheWeekIndex = dayOfTheWeekIndex;
     this.dayOfTheWeek = dayOfTheWeek;
     this.month = month;
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:16,代码来源:TimeChangeRecurrence.cs


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