Skip to content

Instantly share code, notes, and snippets.

@scichelli
Created January 11, 2014 20:04
Show Gist options
  • Save scichelli/8376006 to your computer and use it in GitHub Desktop.
Save scichelli/8376006 to your computer and use it in GitHub Desktop.
public class MyCoolService
{
public Result<CoolThing> Fetch(Uri uri)
{
HttpResponseMessage response = CallThatThingInTheCloud(uri);
if (response.IsSuccessStatusCode)
{
return new Result<CoolThing>
{
IsSuccess = true,
Results = Deserialize(response)
};
}
return new Result<CoolThing>
{
IsSuccess = false,
ErrorMessage = string.Format("Error {0}: {1}",
response.StatusCode, response.ReasonPhrase)
};
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment