Created
March 3, 2014 23:01
-
-
Save tophyr/9336450 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void DoStuff() | |
{ | |
SendData("https://blah", "blah").ContinueWith(task => DoEvenMoreStuff()); | |
} | |
private async Task SendData(string url, string data) | |
{ | |
WebRequest req = WebRequest.Create(url); | |
using (StreamWriter writer = new StreamWriter(await req.GetRequestStreamAsync())) // why await here? | |
{ | |
writer.Write(data); | |
writer.Close(); | |
} | |
WebResponse resp = await req.GetResponseAsync(); // or here? we're already executing in the ThreadPool. | |
DoOtherStuff(resp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment