Skip to content

Instantly share code, notes, and snippets.

@idg10
Created September 19, 2018 05:58
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 idg10/bbb78cc21ef84d02b90c3d7a7fd2cc4e to your computer and use it in GitHub Desktop.
Save idg10/bbb78cc21ef84d02b90c3d7a7fd2cc4e to your computer and use it in GitHub Desktop.
Fixed resource handling with Task-based deferred execution
public static async Task<string> GetContentAsync(string configPath)
{
using (var reader = new StreamReader(configPath))
{
return await reader.ReadToEndAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment