Using Google Map to calculate the distance between two UK postcodes

Below is the code for finding the distance between two uk postcodes using Google Map API 
 
using GoogleMaps.LocationServices;
Get the distance Between two UK Post codes

public double distance(DistanceObject place1, DistanceObject place2, char unit)
{
Double theta = (Double)place1.Longitude -(Double) place2.Longitude;
Double distance = Math.Sin(deg2rad((Double)place1.Latitude)) * Math.Sin(deg2rad((Double)place2.Latitude)) + Math.Cos(deg2rad((Double)place1.Latitude)) * Math.Cos(deg2rad((Double)place2.Latitude)) * Math.Cos(deg2rad(theta));
distance = rad2deg(Math.Acos(distance))* 60 * 1.1515;
switch (unit)
{
case 'K':
distance = distance * 1.609344;
break;
case 'M':
distance = distance * 0.8684;
break;
}
return (distance);
}
 
Get the Longitude and Latitude of a place using the  Address and Google API

//Get GoogleMaps.LocationServices from Nuget package.
public MapPoint ReturnLongitudeAndLatitude(string address)
{
var locationService = new GoogleLocationService();
MapPoint point = locationService.GetLatLongFromAddress(address);
return point;
}