我有一个CSV文件;将其转换为Stream。我需要一种在不将流转换为字符串的情况下修改头的方法。有办法绕过吗?
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
//need to update stream here & continue with the CSV reader
using (CsvReader csv = new CsvReader(new StreamReader(resStream), true))
{
//other code
}
从StreamReader派生您自己的类,并覆盖用于读取它的函数,插入正确的行为。