Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joebuschmann/4058287e99d16aa6068a947235d15a43 to your computer and use it in GitHub Desktop.
Save joebuschmann/4058287e99d16aa6068a947235d15a43 to your computer and use it in GitHub Desktop.
public bool CanRetrieve(KeyValuePair<string, string> keyValuePair,
Type targetType, Type propertyType)
{
return propertyType == typeof(GeoLocation);
}
public object Retrieve(KeyValuePair<string, string> keyValuePair,
Type targetType, Type propertyType)
{
string coordinates = keyValuePair.Value;
GeoLocation location;
if (TryGetLocation(coordinates, out location))
return location;
throw new Exception(
$"Unable to parse the location coordinates {coordinates}.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment