本文整理汇总了C#中Period.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Period.GetHashCode方法的具体用法?C# Period.GetHashCode怎么用?C# Period.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period.GetHashCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Period_EqualsSamePeriod
public void Period_EqualsSamePeriod()
{
var period = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31));
Assert.True(period.Equals(period));
Assert.True(((object)period).Equals(period));
Assert.Equal(period.GetHashCode(), period.GetHashCode());
}
示例2: Period_EqualsEqualPeriod
public void Period_EqualsEqualPeriod()
{
var firstPeriod = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31));
var secondPeriod = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31));
Assert.True(firstPeriod.Equals(secondPeriod));
Assert.True(((object)firstPeriod).Equals(secondPeriod));
Assert.Equal(firstPeriod.GetHashCode(), secondPeriod.GetHashCode());
Assert.True(firstPeriod == secondPeriod);
}
示例3: Period_DoesNotEqualDifferentPeriod
public void Period_DoesNotEqualDifferentPeriod()
{
var firstPeriod = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31));
var secondPeriod = new Period(new DateTime(2009, 1, 1), new DateTime(2010, 1, 31));
Assert.False(firstPeriod.Equals(secondPeriod));
Assert.False(((object)firstPeriod).Equals(secondPeriod));
Assert.False(firstPeriod.Equals(new object()));
Assert.NotEqual(firstPeriod.GetHashCode(), secondPeriod.GetHashCode());
Assert.True(firstPeriod != secondPeriod);
}
示例4: SpecialAssertEqual
private void SpecialAssertEqual(Period period1, Period period2)
{
Assert.AreEqual(period1.GetHashCode(), period2.GetHashCode());
// Don't use Assert.Equals, which will iterate over the period
Assert.IsTrue(period1.Equals(period2));
}
示例5: Bug3258032
public void Bug3258032()
{
Period p = new Period();
p.GetHashCode();
}