Hello,
I have a problem with the conversion of a byte[] object into a bitmap object.
My object is defined as follow :
byte [] myObject.Image; //(this is the type the Intellicense send me)
I try to convert this variable into a bitmap type like this :
MemoryStream
ms = new MemoryStream(myObject.Image);Bitmap
bmp = new Bitmap(new System.IO.MemoryStream(ms));I define a MemoryStream(byte[] buffer) but when I build my project, and tough the type seems correct, I have this error :
Error : The best overloaded method match for 'System.IO.MemoryStream.MemoryStream(int)' has some invalid arguments C:\mypath.cs 3582 49 myProject
Can someone help me ?
TIA
prado fredericPosted Jan 31, 2008, 3:07 AM
thx for the response, it solved this problem.
AlanPosted Jan 30, 2008, 4:25 AM
It looks to me as though you're trying to create a new MemoryStream from an existing one. However, there is no overload of the MemoryStream constructor which takes a Stream as a parameter and the compiler is therefore looking at the one which takes an int as the 'best overload' and failing on that.
Try replacing this line:
Bitmap bmp = new Bitmap(new System.IO.MemoryStream(ms));
with this:
Bitmap bmp = new Bitmap(ms);