GetHashCode() public method

public GetHashCode ( obj ) : int
return int
示例#1
0
            public int GetHashCode(IXmlIdentity name)
            {
                var code = NameComparer.GetHashCode(name.Name.LocalName);

                if (name.XsiType != XmlName.Empty)
                {
                    code = (code << 7 | code >> 25) ^ XsiTypeComparer.GetHashCode(name.XsiType);
                }

                // DO NOT include NamespaceUri in hash code.
                // That would break 'null means any' behavior.

                return(code);
            }
        public void Return_Correct_HashCode_From_Fields()
        {
            var name = CreateName();
            int expectedHashCode = (byte)name.MutKod ^ name.NmEtiket.GetHashCode() ^ name.NmMemo.GetHashCode() ^
                                   name.NmNaam.GetHashCode() ^ name.NmNm40.GetHashCode() ^ name.NmNr;

            var comparer = new NameComparer();
            int result = comparer.GetHashCode(name);

            Assert.AreEqual(expectedHashCode, result);
        }
示例#3
0
 public override int GetHashCode()
 {
     return(NameComparer.GetHashCode(this.UniqueName));
 }