[Mono-list] MemoryStream problem

Elan Feingold efeingold@mn.rr.com
Sun, 23 Feb 2003 15:19:01 -0600


I have the following code:

            MemoryStream mem = new MemoryStream();
            CryptoStream crypto = new CryptoStream (mem, encrypt,
CryptoStreamMode.Write);
            crypto.Write (plain, offset, length);
            crypto.FlushFinalBlock();
            
            byte[] retVal = mem.ToArray();

The code for MemoryStream.ToArray() starts with:

public virtual byte[] ToArray() { 
                        byte[] outBuffer = new byte[capacity];

What's happening is that outBuffer is coming back null! I'm only
requesting 3864 bytes, so I find that extremely odd.

Any advice?

Thanks,

-elan