How to increase the capacity in Memory Stream?

这一生的挚爱 提交于 2019-12-12 07:05:09

问题


I am using MemoryStream to store a report. But the MemoryStream won't store the report if the size of the report is more than 70000. So I should increase the size of the MemoryStream in that case. How can I increase the size of the MemoryStream?

say for example,

mstream=new MemoryStream();
stream.copyTo(mstream); // Here stream contains the report
mstream.position=0;

In this case how can I increase the capacity of MemoryStream so that it can store even if the report size is more than 7000. Please help as I am a beginner in C#.


回答1:


you should use

MemoryTributary d = new MemoryTributary();
 int a = d.ReadByte();  
 d.SetLength(10000);  
int b = d.ReadByte();


来源:https://stackoverflow.com/questions/39850007/how-to-increase-the-capacity-in-memory-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!