如何增加Memory Stream的容量? [英] How to increase the capacity in Memory Stream?

查看:179
本文介绍了如何增加Memory Stream的容量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MemoryStream存储报告.但是,如果报告的大小大于70000,则MemoryStream不会存储该报告.因此,在这种情况下,我应该增加MemoryStream的大小.如何增加MemoryStream的大小?

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?

例如,

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

在这种情况下,我如何增加MemoryStream的容量,以便即使报表大小超过7000,也可以存储它. 请帮助,因为我是C#的初学者.

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#.

推荐答案

您应该使用

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

这篇关于如何增加Memory Stream的容量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆