Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Data1.Length != 0)
            {
                hash ^= Data1.GetHashCode();
            }
            if (Data2.Length != 0)
            {
                hash ^= Data2.GetHashCode();
            }
            if (Data3.Length != 0)
            {
                hash ^= Data3.GetHashCode();
            }
            if (myOneOfCase_ == MyOneOfOneofCase.One)
            {
                hash ^= One.GetHashCode();
            }
            if (myOneOfCase_ == MyOneOfOneofCase.Two)
            {
                hash ^= Two.GetHashCode();
            }
            if (myOneOfCase_ == MyOneOfOneofCase.Three)
            {
                hash ^= Three.GetHashCode();
            }
            hash ^= (int)myOneOfCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public static void GetHashCode_Some()
        {
            Assert.Equal(1.GetHashCode(), One.GetHashCode());
            Assert.Equal(2.GetHashCode(), Two.GetHashCode());
            Assert.Equal(2L.GetHashCode(), TwoL.GetHashCode());
#if !(NETSTANDARD2_0 || NETSTANDARD1_x || NETFRAMEWORK) // GetHashCode(StringComparison)
            Assert.Equal(MyText.GetHashCode(StringComparison.Ordinal), SomeText.GetHashCode());
#endif
            Assert.Equal(MyUri.GetHashCode(), SomeUri.GetHashCode());

            var anyT = AnyT.New();
            Assert.Equal(anyT.Value.GetHashCode(), anyT.Some.GetHashCode());
        }
Example #3
0
 public override int GetHashCode()
 {
     return(One.GetHashCode() ^ Two.GetHashCode() ^ Three.GetHashCode());
 }