Skip to content

Instantly share code, notes, and snippets.

@idkaaa
Last active February 2, 2016 15:58
Show Gist options
  • Save idkaaa/e6f224e29b9a78a3d43a to your computer and use it in GitHub Desktop.
Save idkaaa/e6f224e29b9a78a3d43a to your computer and use it in GitHub Desktop.
public async Task DoWork()
{
//blocking
//int res = await Task.FromResult<int>(GetSum(4, 5));
//non-blocking
int res = await Task<int>.Run(() => GetSum(4, 5));
}
private int GetSum(int a, int b)
{
return a + b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment