title: How do I sort objects in VB.net with custom comparer elegantly?
body: <p>I want to sort a bunch of domainsdata object. I want to sort first based on countryCode then I want to sort based on revenue.</p>
  
  <p>First I created a private comparer.</p>
  
  <pre><code>Private Function CompareDomainCountry(ByVal x As domainsData, ByVal y As domainsData) As Integer
      If x.countryCode &lt; y.countryCode Then
          Return -1
      ElseIf y.countryCode &lt; x.countryCode Then
          Return 1
      ElseIf x.revenue &lt; y.revenue Then
          Return 1
      ElseIf y.revenue &lt; x.revenue Then
          Return -1
      Else
          Return 0
      End If
  End Function
  </code></pre>
  
  <p>This has several problem.</p>
  
  <p>The comparer returns 1,-1,0. I think there should be a normal enum for that.</p>
  
  <p>Also I think my comparer should simply call standard vb.net comparer.</p>
  
  <p>And after that, how do I sort list (of domainsdata)?</p>
  
  <p>comparer?</p>