本文整理汇总了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;
}
}
示例2: MonthRange
public MonthRange(Month startMonth, int startYear, Month endMonth, int endYear)
{
StartYear = startYear;
StartMonth = (int)startMonth;
EndMonth = (int)endMonth;
EndYear = endYear;
}
示例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));
}
示例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;
}
示例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;
}
示例6: DayOfWeekAnnualReccurance
public DayOfWeekAnnualReccurance(DayOfWeek dayOfWeek, WeekOfMonth week, Month month, bool substituteWeekend = true)
: base(substituteWeekend)
{
DayOfWeek = dayOfWeek;
Week = week;
Month = month;
}
示例7: op_ToMonth_string
public void op_ToMonth_string()
{
var expected = new Month(2010, 11);
var actual = "2010-11".ToMonth();
Assert.Equal(expected, actual);
}
示例8: CalendarDay
public CalendarDay(DayOfWeek dayOfWeek, int year, Month month, int dayOfMonth)
{
DayOfWeek = dayOfWeek;
Year = year;
Month = month;
DayOfMonth = dayOfMonth;
}
示例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);
}
示例10: CalculatePTServiceCommission
public void CalculatePTServiceCommission(int aEmployeeID, string aBranchCode, Month aMonth, int aYear)
{
nEmployeeID = aEmployeeID;
strBranchCode = aBranchCode;
month = aMonth;
year = aYear;
ProcessCalculation();
}
示例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();
}
示例12: AdvanceMonth
public void AdvanceMonth()
{
this.month++;
if (this.month == Month.December + 1)
{
this.month = Month.January;
this.year++;
}
}
示例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;
}
示例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;
}
示例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;
}