Created
August 3, 2018 13:21
-
-
Save joebuschmann/4058287e99d16aa6068a947235d15a43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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