Skip to content

Instantly share code, notes, and snippets.

@mabuenox
Created February 12, 2017 19:29
Show Gist options
  • Save mabuenox/0991a2f3c506b495a6c96f9a2995582c to your computer and use it in GitHub Desktop.
Save mabuenox/0991a2f3c506b495a6c96f9a2995582c to your computer and use it in GitHub Desktop.
public class DistanceCalculator
{
public int CalculateDistanceInKm(string origin, string destination)
{
if (string.IsNullOrEmpty(origin)
{
throw new ArgumentNullException("You tried to provide a null or empty origin; please supply a valid city name");
}
if (string.IsNullOrEmpty(destination)
{
throw new ArgumentNullException("You tried to provide a null or empty destination; please supply a valid city name");
}
return GoogleMaps.DistanceMatrix.Query(origin, destination);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment