我正在收到网络回复并尝试在其中找到ID。 我写道:
HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
var regex = new Regex(@"([0-9]+)(?=\) title=)");
return regex.Match(readStream.ToString()).ToString(); //suppose there is a problem
有什么问题?
答案 0 :(得分:3)
readStream.ToString
应该返回类似System.Object.StreamReader
的内容,因为它是此方法的默认实现。
尝试改为使用readStream.ReadToEnd()
。