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

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

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

google shop client API returns 400 bad request error while adding an item -