graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Intent of GraphQLRequest.GetHashCode()

Open kwhopper opened this issue 3 years ago • 0 comments
trafficstars

https://github.com/graphql-dotnet/graphql-client/blob/0b49bfcc59dbd21837eb1732cc01c354efb341d4/src/GraphQL.Primitives/GraphQLRequest.cs#L87

Is the intent of this to return the same hash based on the property values in any instance? It won't work as a "these two objects have the same property values" hash because Variables is an object and object.GetHashCode generally returns a hash to the instance in memory.

If you're using it as an "instance" hash that's fine - but you don't really need the Tuple then. You could just do Variables.ToString(). But if this is to indicate that two or more instances of this class contain the same property values, I don't think that's ever true.

kwhopper avatar Apr 01 '22 21:04 kwhopper