Skip to content

Instantly share code, notes, and snippets.

@shahriarhossain
Last active December 9, 2015 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahriarhossain/eed8e16a4b1dfad3556c to your computer and use it in GitHub Desktop.
Save shahriarhossain/eed8e16a4b1dfad3556c to your computer and use it in GitHub Desktop.
public class BaseOperation
{
public async Task<T> GetAsync<T>(string endpoint) where T : class
{
string content;
using (var client = new HttpClient())
{
try
{
Authenticate.ClientAuthentication(client);
content = await client.GetStringAsync(endpoint).ConfigureAwait(false);
}
catch (Exception ex)
{
throw ex;
}
}
return JsonConvert.DeserializeObject<T>(content);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment