예제 #1
0
        // Token: 0x0600046C RID: 1132 RVA: 0x0000DA6C File Offset: 0x0000BC6C
        private int GetHashCodeCore(IEqualityComparer comparer)
        {
            IValueTupleInternal valueTupleInternal = this.Rest as IValueTupleInternal;

            if (valueTupleInternal == null)
            {
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item1), comparer.GetHashCode(this.Item2), comparer.GetHashCode(this.Item3), comparer.GetHashCode(this.Item4), comparer.GetHashCode(this.Item5), comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7)));
            }
            int length = valueTupleInternal.Length;

            if (length >= 8)
            {
                return(valueTupleInternal.GetHashCode(comparer));
            }
            switch (8 - length)
            {
            case 1:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            case 2:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            case 3:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item5), comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            case 4:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item4), comparer.GetHashCode(this.Item5), comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            case 5:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item3), comparer.GetHashCode(this.Item4), comparer.GetHashCode(this.Item5), comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            case 6:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item2), comparer.GetHashCode(this.Item3), comparer.GetHashCode(this.Item4), comparer.GetHashCode(this.Item5), comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            case 7:
            case 8:
                return(ValueTuple.CombineHashCodes(comparer.GetHashCode(this.Item1), comparer.GetHashCode(this.Item2), comparer.GetHashCode(this.Item3), comparer.GetHashCode(this.Item4), comparer.GetHashCode(this.Item5), comparer.GetHashCode(this.Item6), comparer.GetHashCode(this.Item7), valueTupleInternal.GetHashCode(comparer)));

            default:
                return(-1);
            }
        }
예제 #2
0
        /// <summary>Calculates the hash code for the current <see cref="T:System.ValueTuple`8" /> instance.</summary>
        /// <returns>The hash code for the current <see cref="T:System.ValueTuple`8" /> instance. </returns>
        // Token: 0x0600046A RID: 1130 RVA: 0x0000D774 File Offset: 0x0000B974
        public override int GetHashCode()
        {
            IValueTupleInternal valueTupleInternal = this.Rest as IValueTupleInternal;

            if (valueTupleInternal == null)
            {
                return(ValueTuple.CombineHashCodes(EqualityComparer <T1> .Default.GetHashCode(this.Item1), EqualityComparer <T2> .Default.GetHashCode(this.Item2), EqualityComparer <T3> .Default.GetHashCode(this.Item3), EqualityComparer <T4> .Default.GetHashCode(this.Item4), EqualityComparer <T5> .Default.GetHashCode(this.Item5), EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7)));
            }
            int length = valueTupleInternal.Length;

            if (length >= 8)
            {
                return(valueTupleInternal.GetHashCode());
            }
            switch (8 - length)
            {
            case 1:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            case 2:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            case 3:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T5> .Default.GetHashCode(this.Item5), EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            case 4:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T4> .Default.GetHashCode(this.Item4), EqualityComparer <T5> .Default.GetHashCode(this.Item5), EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            case 5:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T3> .Default.GetHashCode(this.Item3), EqualityComparer <T4> .Default.GetHashCode(this.Item4), EqualityComparer <T5> .Default.GetHashCode(this.Item5), EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            case 6:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T2> .Default.GetHashCode(this.Item2), EqualityComparer <T3> .Default.GetHashCode(this.Item3), EqualityComparer <T4> .Default.GetHashCode(this.Item4), EqualityComparer <T5> .Default.GetHashCode(this.Item5), EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            case 7:
            case 8:
                return(ValueTuple.CombineHashCodes(EqualityComparer <T1> .Default.GetHashCode(this.Item1), EqualityComparer <T2> .Default.GetHashCode(this.Item2), EqualityComparer <T3> .Default.GetHashCode(this.Item3), EqualityComparer <T4> .Default.GetHashCode(this.Item4), EqualityComparer <T5> .Default.GetHashCode(this.Item5), EqualityComparer <T6> .Default.GetHashCode(this.Item6), EqualityComparer <T7> .Default.GetHashCode(this.Item7), valueTupleInternal.GetHashCode()));

            default:
                return(-1);
            }
        }