Bitmap.PlotSurface2D.ToStream C# (CSharp) Method

ToStream() public method

Renders the bitmap to a MemoryStream. Useful for returning the bitmap from an ASP.NET page.
public ToStream ( ImageFormat imageFormat ) : MemoryStream
imageFormat ImageFormat
return MemoryStream
            public MemoryStream ToStream(ImageFormat imageFormat)
            {
                MemoryStream stream = new MemoryStream();
                ps_.Draw(Graphics.FromImage(this.Bitmap), new Rectangle(0, 0, b_.Width, b_.Height));
                this.Bitmap.Save(stream, imageFormat);
                return stream;
            }