private static string GetPathEncoded(Path currentPath)
{
IEnumerable<LatLng> latlngPoints;
try { latlngPoints = currentPath.Points.Cast<LatLng>().ToList(); }
catch(InvalidCastException ex) { throw new InvalidOperationException("Encountered a point specified as a location. Encoding only supports all points in LatLng types.", ex); }
string encodedValue = PolylineEncoder.EncodeCoordinates(latlngPoints);
return encodedValue;
}