C#上CURLOPT_RETURNTRANSFER的等价物是什么?

时间:2012-10-12 19:55:27

标签: c# curl

当我在PHP中使用curl时,我可以

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

这允许我将结果存储在变量中。

但是C#的libcURL没有返回转移选项。我可以用什么而不是c#?

1 个答案:

答案 0 :(得分:0)

我想等价物必须像这样编码:

WebResponse webResponse = webRequest.GetResponse();
String response = null;
using(var strReader = new StreamReader(webResponse.GetResponseStream()))
{
    response = streamReader.ReadToEnd();
}
相关问题