本文整理汇总了C#中LocalDateTime.ToDateTimeUnspecified方法的典型用法代码示例。如果您正苦于以下问题:C# LocalDateTime.ToDateTimeUnspecified方法的具体用法?C# LocalDateTime.ToDateTimeUnspecified怎么用?C# LocalDateTime.ToDateTimeUnspecified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalDateTime
的用法示例。
在下文中一共展示了LocalDateTime.ToDateTimeUnspecified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToDateTimeUnspecified
public void ToDateTimeUnspecified()
{
LocalDateTime zoned = new LocalDateTime(2011, 3, 5, 1, 0, 0);
DateTime expected = new DateTime(2011, 3, 5, 1, 0, 0, DateTimeKind.Unspecified);
DateTime actual = zoned.ToDateTimeUnspecified();
Assert.AreEqual(expected, actual);
// Kind isn't checked by Equals...
Assert.AreEqual(DateTimeKind.Unspecified, actual.Kind);
}
示例2: IsoDayOfWeek_AroundEpoch
public void IsoDayOfWeek_AroundEpoch()
{
// Test about couple of months around the Unix epoch. If that works, I'm confident the rest will.
LocalDateTime dateTime = new LocalDateTime(1969, 12, 1, 0, 0);
for (int i = 0; i < 60; i++)
{
// Check once per hour of the day, just in case something's messed up based on the time of day.
for (int hour = 0; hour < 24; hour++)
{
Assert.AreEqual(BclConversions.ToIsoDayOfWeek(dateTime.ToDateTimeUnspecified().DayOfWeek),
dateTime.IsoDayOfWeek);
dateTime = dateTime.PlusHours(1);
}
}
}