Difference between revisions of "CSharp:Accesso al FileSystem"
From Aino Wiki
(→Scrittura su FileSystem) |
(No difference)
|
Latest revision as of 18:07, 22 November 2020
Streaming
Scrittura su FileSystem
Scrive un MemoryStream sul fileSystem
MemoryStream stream = new MemoryStream(); //.. // si riempie lo stream //.. string nomeFilePDF = string.Format("AnteprimaOrdini_{0}.pdf", Guid.NewGuid()); string pdfFileNameFullPath = string.Format("{0}{1}{2}", currentApp, c_PDF_RelativeOutputPath, nomeFilePDF); using (var fileStream = new FileStream(pdfFileNameFullPath, FileMode.CreateNew)) { // write to just created file stream.WriteTo(fileStream); } // altro esempio: public static void SaveTextToFile(string textToStore, string fileNameFullPath, bool isAppend) { using (var streamWriter = new StreamWriter(fileNameFullPath, isAppend)) { streamWriter.WriteLine(textToStore); } }
Altre operazioni frequenti
- 1° Link interno Tips_programmazione_libreria
- 2° Link interno Varie sui files
Mappa e Link
Parole chiave: File System, memory stream