本文整理汇总了C#中LocalDateTime.PlusDays方法的典型用法代码示例。如果您正苦于以下问题:C# LocalDateTime.PlusDays方法的具体用法?C# LocalDateTime.PlusDays怎么用?C# LocalDateTime.PlusDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalDateTime
的用法示例。
在下文中一共展示了LocalDateTime.PlusDays方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlusDays_Simple
public void PlusDays_Simple()
{
LocalDateTime start = new LocalDateTime(2011, 1, 15, 12, 15, 8);
LocalDateTime expected = new LocalDateTime(2011, 1, 23, 12, 15, 8);
Assert.AreEqual(expected, start.PlusDays(8));
expected = new LocalDateTime(2011, 1, 7, 12, 15, 8);
Assert.AreEqual(expected, start.PlusDays(-8));
}
示例2: PlusDays_MonthBoundary
public void PlusDays_MonthBoundary()
{
LocalDateTime start = new LocalDateTime(2011, 1, 26, 12, 15, 8);
LocalDateTime expected = new LocalDateTime(2011, 2, 3, 12, 15, 8);
Assert.AreEqual(expected, start.PlusDays(8));
// Round-trip back across the boundary
Assert.AreEqual(start, start.PlusDays(8).PlusDays(-8));
}
示例3: PlusDays_EndOfFebruary_NotInLeapYear
public void PlusDays_EndOfFebruary_NotInLeapYear()
{
LocalDateTime start = new LocalDateTime(2011, 2, 26, 12, 15, 8);
LocalDateTime expected = new LocalDateTime(2011, 3, 6, 12, 15, 8);
Assert.AreEqual(expected, start.PlusDays(8));
// Round-trip back across the boundary
Assert.AreEqual(start, start.PlusDays(8).PlusDays(-8));
}