JetBrains Rider 2026.2 Help

Code inspection: Use 'HashCode.Combine' to calculate the hash code

This inspection reports hash-code calculations that create a temporary value tuple and call GetHashCode() on it. When System.HashCode is available, HashCode.Combine(...) expresses the same intent directly and avoids using a temporary tuple. The inspection is reported for ValueTuple.GetHashCode() calls with up to 8 tuple components. For larger tuples, use a hash-code calculation that includes every component.

Example

using System; public sealed class Customer(int id, string name) { public override int GetHashCode() { return (id, name).GetHashCode(); } }
using System; public sealed class Customer(int id, string name) { public override int GetHashCode() { return HashCode.Combine(id, name); } }

Quick-fix

Replace the ValueTuple.GetHashCode() call with HashCode.Combine(...). Tuple element names do not affect the hash code and are not included in the replacement.

13 July 2026