Login Login
MORE

WIDGETS

Widgets

Wanted articles
Who is online?
Article tools

CSharp:Accesso al FileSystem

From Aino Wiki

Jump to: navigation, search

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

Mappa e Link


C# | Alias_PaginaPadre


Visual Studio


Parole chiave: File System, memory stream

Author Giuseppe AINO