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 -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -