Search code examples
c#asp.netstreammemorystream

How to increase the capacity in Memory Stream?


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


Solution

  • you should use

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