Show / Hide Table of Contents

Class GaxEqualityHelpers

Convenience methods to simplify implementing equality comparisons and hash codes.

Inheritance
System.Object
GaxEqualityHelpers
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api.Gax
Assembly: Google.Api.Gax.dll
Syntax
public static class GaxEqualityHelpers

Methods

CombineHashCodes(Int32, Int32)

Combines two hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

Returns
Type Description
System.Int32

The combined hash code.

CombineHashCodes(Int32, Int32, Int32)

Combines three hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2, int hash3)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

System.Int32 hash3

The third hash code.

Returns
Type Description
System.Int32

The combined hash code.

CombineHashCodes(Int32, Int32, Int32, Int32)

Combines four hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2, int hash3, int hash4)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

System.Int32 hash3

The third hash code.

System.Int32 hash4

The fourth hash code.

Returns
Type Description
System.Int32

The combined hash code.

CombineHashCodes(Int32, Int32, Int32, Int32, Int32)

Combines five hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2, int hash3, int hash4, int hash5)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

System.Int32 hash3

The third hash code.

System.Int32 hash4

The fourth hash code.

System.Int32 hash5

The fifth hash code.

Returns
Type Description
System.Int32

The combined hash code.

CombineHashCodes(Int32, Int32, Int32, Int32, Int32, Int32)

Combines six hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

System.Int32 hash3

The third hash code.

System.Int32 hash4

The fourth hash code.

System.Int32 hash5

The fifth hash code.

System.Int32 hash6

The sixth hash code.

Returns
Type Description
System.Int32

The combined hash code.

CombineHashCodes(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Combines seven hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6, int hash7)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

System.Int32 hash3

The third hash code.

System.Int32 hash4

The fourth hash code.

System.Int32 hash5

The fifth hash code.

System.Int32 hash6

The sixth hash code.

System.Int32 hash7

The seventh hash code.

Returns
Type Description
System.Int32

The combined hash code.

CombineHashCodes(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Combines eight hash codes.

Declaration
public static int CombineHashCodes(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6, int hash7, int hash8)
Parameters
Type Name Description
System.Int32 hash1

The first hash code.

System.Int32 hash2

The second hash code.

System.Int32 hash3

The third hash code.

System.Int32 hash4

The fourth hash code.

System.Int32 hash5

The fifth hash code.

System.Int32 hash6

The sixth hash code.

System.Int32 hash7

The seventh hash code.

System.Int32 hash8

The eight hash code.

Returns
Type Description
System.Int32

The combined hash code.

GetListHashCode<T>(IReadOnlyList<T>)

Computes an ordering-sensitive hash code for a list, using the given equality comparer.

Declaration
public static int GetListHashCode<T>(IReadOnlyList<T> list)
    where T : IEquatable<T>
Parameters
Type Name Description
System.Collections.Generic.IReadOnlyList<T> list

The list to compute a hash code for. May be null.

Returns
Type Description
System.Int32

The computed hash code.

Type Parameters
Name Description
T

ListsEqual<T>(IReadOnlyList<T>, IReadOnlyList<T>)

Checks if two lists are equal, in an ordering-sensitive manner, using the default equality comparer for the type.

Declaration
public static bool ListsEqual<T>(IReadOnlyList<T> left, IReadOnlyList<T> right)
    where T : IEquatable<T>
Parameters
Type Name Description
System.Collections.Generic.IReadOnlyList<T> left

The left list to compare. May be null.

System.Collections.Generic.IReadOnlyList<T> right

The right list to compare. May be null.

Returns
Type Description
System.Boolean

Whether or not the lists are equal

Type Parameters
Name Description
T
Back to top