Stream Byte[] 转换
public byte[] StreamToBytes(Stream stream) { byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); stream.Seek(0, SeekOrigin.Begin); return bytes; } public Stream BytesToStream(byte[] bytes) { Stream stream = new MemoryStream(bytes); return stream; }