我正在嘗試將 responseStream 讀取到最后,并在 br.ReadBytes 行中收到錯誤“不支持指定的方法”。我究竟做錯了什么?WebResponse imageResponse = imageRequest.GetResponse();Stream responseStream = imageResponse.GetResponseStream();using (BinaryReader br = new BinaryReader(responseStream)){ imageBytes = br.ReadBytes((int)responseStream.Length); br.Close();}
1 回答

ITMISS
TA貢獻(xiàn)1871條經(jīng)驗 獲得超8個贊
我收到錯誤:NotSupportedException:此流不支持查找操作。
假設(shè)您想要一個字節(jié)數(shù)組,為什么不讓獲取圖像變得更容易:
byte[] imageBytes
using (var webClient = new WebClient()) {
imageBytes = webClient.DownloadData("http://yourimage");
}
- 1 回答
- 0 關(guān)注
- 159 瀏覽
添加回答
舉報
0/150
提交
取消