Skip to content

Instantly share code, notes, and snippets.

@mr5z

mr5z/AsyncGotcha.cs

Created Dec 26, 2020
Embed
What would you like to do?
Aaaa
// Correct
public static async Task<string> StreamToString(Stream stream)
{
using var reader = new StreamReader(stream);
return await reader.ReadToEndAsync();
}
// Incorrect
public static Task<string> StreamToString(Stream stream)
{
using var reader = new StreamReader(stream);
return reader.ReadToEndAsync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment