c# - Memorystream - OutOfMemoryException -


it might question has been answered before, found no solution problem.

i trying convert bitmap bytearray using memory stream, when out of memory exception, , can't figure out , going wrong. below can find code, , grateful insight on topic.

static byte[] convertbmptobytearray(string imagefilepath)     {         bitmap bmpimg = (bitmap)bitmap.fromfile(imagefilepath);         try         {             using (memorystream ms = new memorystream())             {                 bmpimg.save(ms, imageformat.bmp);                  return ms.toarray();             }         } catch(exception e)         {             console.writeline(e.stacktrace);             return null;         }     } 


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -