本文整理汇总了C#中DateTimeOffset.EqualsExact方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeOffset.EqualsExact方法的具体用法?C# DateTimeOffset.EqualsExact怎么用?C# DateTimeOffset.EqualsExact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeOffset
的用法示例。
在下文中一共展示了DateTimeOffset.EqualsExact方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareTwoDateInDiffTZ
public void CompareTwoDateInDiffTZ ()
{
DateTimeOffset dt1 = new DateTimeOffset (2007, 12, 16, 15, 06, 00, new TimeSpan (1, 0, 0));
DateTimeOffset dt2 = new DateTimeOffset (2007, 12, 16, 9, 06, 00, new TimeSpan (-5, 0, 0));
DateTimeOffset dt3 = new DateTimeOffset (2007, 12, 16, 14, 06, 00, new TimeSpan (1, 0, 0));
object o = dt1;
Assert.IsTrue (dt1.CompareTo (dt2) == 0);
Assert.IsTrue (DateTimeOffset.Compare (dt1, dt2) == 0);
Assert.IsTrue (dt1 == dt2);
Assert.IsTrue (dt1.Equals (dt2));
Assert.IsFalse (dt1 == dt3);
Assert.IsTrue (dt1 != dt3);
Assert.IsFalse (dt1.EqualsExact (dt2));
Assert.IsTrue (dt1.CompareTo (dt3) > 0);
Assert.IsTrue (((IComparable)dt1).CompareTo (o) == 0);
}
示例2: Equals
public static void Equals(DateTimeOffset dateTimeOffset1, object obj, bool expectedEquals, bool expectedEqualsExact)
{
Assert.Equal(expectedEquals, dateTimeOffset1.Equals(obj));
if (obj is DateTimeOffset)
{
DateTimeOffset dateTimeOffset2 = (DateTimeOffset)obj;
Assert.Equal(expectedEquals, dateTimeOffset1.Equals(dateTimeOffset2));
Assert.Equal(expectedEquals, DateTimeOffset.Equals(dateTimeOffset1, dateTimeOffset2));
Assert.Equal(expectedEquals, dateTimeOffset1.GetHashCode().Equals(dateTimeOffset2.GetHashCode()));
Assert.Equal(expectedEqualsExact, dateTimeOffset1.EqualsExact(dateTimeOffset2));
Assert.Equal(expectedEquals, dateTimeOffset1 == dateTimeOffset2);
Assert.Equal(!expectedEquals, dateTimeOffset1 != dateTimeOffset2);
}
}