WebClient.OpenWriteTaskAsync示例

时间:2013-05-29 22:41:01

标签: .net webclient

好的,所以这个让谷歌完全难过。有没有人有WebClient.OpenWriteTaskAsync的例子,您还可以在其中阅读响应?我理解如何编写请求并处理异常情况,但我无法弄清楚如何阅读响应。

try 
{
    using (var stream = await client.OpenWriteTaskAsync(url,method))
    {
      new XmlSerializer(sometype).Serialize(someobject,stream);
    }
    // at this point the request has been sent - how to get at the response data?
}
catch (WebException wex)
{
    // handle exception
}

0 个答案:

没有答案