本文整理汇总了C#中HashCodeCombiner.GetCombinedHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# HashCodeCombiner.GetCombinedHashCode方法的具体用法?C# HashCodeCombiner.GetCombinedHashCode怎么用?C# HashCodeCombiner.GetCombinedHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HashCodeCombiner
的用法示例。
在下文中一共展示了HashCodeCombiner.GetCombinedHashCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HashCombiner_Test_Int
public void HashCombiner_Test_Int()
{
var combiner1 = new HashCodeCombiner();
combiner1.AddInt(1234);
var combiner2 = new HashCodeCombiner();
combiner2.AddInt(1234);
Assert.AreEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
combiner2.AddInt(1);
Assert.AreNotEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
}
示例2: HashCombiner_Test_String
public void HashCombiner_Test_String()
{
var combiner1 = new HashCodeCombiner();
combiner1.AddCaseInsensitiveString("Hello");
var combiner2 = new HashCodeCombiner();
combiner2.AddCaseInsensitiveString("hello");
Assert.AreEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
combiner2.AddCaseInsensitiveString("world");
Assert.AreNotEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
}
示例3: HashCombiner_Test_Type
public void HashCombiner_Test_Type()
{
var combiner1 = new HashCodeCombiner();
combiner1.AddType(typeof(HashCodeCombiner));
var combiner2 = new HashCodeCombiner();
combiner2.AddType(typeof(HashCodeCombiner));
var combiner3 = new HashCodeCombiner();
combiner3.AddType(typeof(HashCodeCombinerTests));
Assert.AreEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
Assert.AreNotEqual(combiner2.GetCombinedHashCode(), combiner3.GetCombinedHashCode());
combiner2.AddType(typeof(HashCodeCombiner));
Assert.AreNotEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
}
示例4: HashCombiner_Test_Bool
public void HashCombiner_Test_Bool()
{
var combiner1 = new HashCodeCombiner();
combiner1.AddBool(true);
var combiner2 = new HashCodeCombiner();
combiner2.AddBool(true);
var combiner3 = new HashCodeCombiner();
combiner3.AddBool(false);
Assert.AreEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
Assert.AreNotEqual(combiner2.GetCombinedHashCode(), combiner3.GetCombinedHashCode());
combiner2.AddBool(true);
Assert.AreNotEqual(combiner1.GetCombinedHashCode(), combiner2.GetCombinedHashCode());
}