title: Overriding GetHashCode variations
body: <p>I have a theoretical class Name_Order, that has a string <code>Name</code> and a int <code>Order</code>.</p>
  
  <p>I need to indicate that two <code>Name_Order</code>'s are different, if the pair NameOrder is different, that is, or name or order are different.</p>
  
  <p>Now, overriding Equals <em>no problemo</em>, but I have some "issues" with GetHashCode:</p>
  
  <pre><code>Public Class Name_Order
    Public Property Name As String
    Public Property Order As Integer
  
    Public Overrides Function Equals(ByVal obj As Object) As Boolean
      If TypeOf obj Is Name_Order Then
        Dim no = DirectCast(obj, Name_Order)
        Return Me.Name = no.Name AndAlso Me.Order = no.Order
      Else
        Return MyBase.Equals(obj)
      End If
    End Function
  
    Public Overrides Function GetHashCode() As Integer
      Dim hcName = 0
      If Me.Name IsNot Nothing Then
        hcName = Me.Name.GetHashCode
      End If
  
      Dim hcOrder = Me.Order.GetHashCode
  
      Return hcName + hcOrder
    End Function
  End Class
  </code></pre>
  
  <p>In that case, summing the hashcodes, leave a (small, but real) possibility that two distinct Name_Orders with different names or orders be "identical".</p>
  
  <p>Say, adding the <code>7</code> + <code>154</code> gives the same result as adding <code>154</code> + <code>7</code>...</p>
  
  <p>An alternative override of that method?</p>