title: .NET Equivalent of SQL Server STDistance
body: <p>I can use the following SQL to calculate the distance between a fixed location and the location against the venues in the database.</p>
  
  <pre><code>SELECT Location.STDistance(geography::Point(51, -2, 4326)) * 0.00062137119 FROM Venues
  </code></pre>
  
  <p>Please note the distance returned is in miles and the Location field is a geography type.</p>
  
  <p>I was wondering what is the equivalent of this in .NET which would return the same values. This method would have the following signature:</p>
  
  <pre><code>public static double Distance(location1Latitude, location1Longitude, location2Latitude, location2Longitude) {
      return ...;
  }
  </code></pre>
  
  <p>I know I could call the database method in .NET but I don't wish to do this. I'm hoping there is a formula to calculate the distance. Thanks</p>