c# - File.Copy a file created in memory -


so create file:

memorystream ms = new memorystream(); textwriter tw = new streamwriter(ms); tw.writeline("hello world!"); tw.flush(); byte[] bytes = ms.getbuffer(); 

how can use file.copy() to, well, copy file new file?

use file.writeallbytes create new file (or overwrite existing file) byte array:

file.writeallbytes(filename, bytes); 

note memorystream (what created) isn't "file", file.copy can't used.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -