file

I/O File
Quando si scrivono applicazioni desktop, è importante prevedere la possibilità di **salvare le informazioni tra una sessione utente e l'altra**. Generalmente il salvataggio avviene **su file**, in memoria di massa. Le operazioni su memoria di massa sono operazioni di I/O, così come lo sono le operazioni verso la rete e verso la console. Il namespace di C#, preposto all'I/O, è System.IO. Quindi ricordiamoci lo **using System.IO;**. Molti dei tipi (classi, interfacce, enumerazioni, ...) contenuti in System.IO  riguardano la manipolazione fisica di **directory** e **file**. C# fornisce numerose classi per manipolare i file e gli stream di input e output.  Ecco una rassegna delle classi principali per manipolare i **file** e le **directory** (che come sappiamo dalla teoria dei sistemi operativi, sono file particolari) : > NOTA: La classe FileStream implementa IDisposable. Per usare i suoi metodi bisogna usare la parola chiave **using** per evitare di gestire le eccezioni che l'interfaccia implementa. > NOTA: File, FileInfo, DriveInfo, Path, Directory, e DirectoryInfo <span style="font-family: Verdana,sans-serif; font-size: 12px;"> sono classi sealed. Non è perciò possibile usarle come classi base per nuove gerarchie (no derivazione da esse!!). <span style="display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">E ora le classi principali per la gestione degli **stream**: <span style="display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">Per **leggere o scrivere** dati verso un **file**, **è necessario associarvi stream**. <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;"><span style="font-family: Verdana,sans-serif;">Le classi <span style="font-family: Courier New,monospace;">File <span style="font-family: Verdana,sans-serif;"> e <span style="font-family: Courier New,monospace;">FileInfo <span style="font-family: Verdana,sans-serif; font-size: 12px;">(che derivano dalla classe astratta <span style="font-family: Courier New,monospace; font-size: 12px;">Stream <span style="font-family: Verdana,sans-serif; font-size: 12px;">) <span style="font-family: Verdana,sans-serif;"> aprono un file e gli associano automaticamente uno stream <span style="font-family: Verdana,sans-serif; font-size: 12px;">(in lettura, scrittura o lettura/scrittura a seconda del metodo usato per l'apertura). <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;"><span style="font-family: Verdana,sans-serif;">Le classi <span style="font-family: Courier New,monospace;">StreamReader <span style="font-family: Verdana,sans-serif;"> e <span style="font-family: Courier New,monospace;">StreamWriter <span style="font-family: Verdana,sans-serif; font-size: 12px;">(che derivano da <span style="font-family: Courier New,monospace; font-size: 12px;">Stream <span style="font-family: Verdana,sans-serif; font-size: 12px;">) <span style="font-family: Verdana,sans-serif;">creanouno stream e lo associano ad un file. <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;"><span style="font-family: Verdana,sans-serif;">Le classi <span style="font-family: Courier New,monospace;">BinaryReader <span style="font-family: Verdana,sans-serif;"> e <span style="font-family: Courier New,monospace;">BinaryWriter <span style="font-family: Verdana,sans-serif; font-size: 12px;">(che non derivano da <span style="font-family: Courier New,monospace; font-size: 12px;">Stream) <span style="font-family: Verdana,sans-serif;"> non forniscono direttamente uno stream, ma ne chiedono uno come parametro di costruzione.
 * <span style="font-family: Verdana,sans-serif; font-size: 12px;">**Directory** <span style="font-family: Verdana,sans-serif; font-size: 12px;">consente di utilizzare <span style="font-family: Verdana,sans-serif; font-size: 12px; text-decoration: none;">**metodi statici** <span style="font-family: Verdana,sans-serif; font-size: 12px;">per la creazione, lo spostamento e l'elencazione di **directory** <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;"> e sottodirectory.
 * <span style="display: block; font-family: Verdana,sans-serif; text-align: justify;"> **DirectoryInfo**consente di utilizzare **metodi di istanza** (cioè posso creare oggetti) per la creazione, lo spostamento e l'elencazione di **directory** e sottodirectory.
 * <span style="display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">**DriveInfo**fornisce metodi di istanza per l'accesso alle informazioni su un'**unità**.
 * <span style="font-family: Verdana,sans-serif;"> **File**fornisce i **metodi statici** per creare, copiare, eliminare, spostare e aprire i **file**. Permette di creare oggetti <span style="font-family: Courier New,monospace; font-size: 12px;">**FileStream** <span style="font-family: Verdana,sans-serif; font-size: 12px;">.
 * <span style="font-family: Verdana,sans-serif;"> **FileInfo**fornisce i **metodi di istanza** per creare, copiare, eliminare, spostare e aprire i **file**. Permette di creare oggetti <span style="font-family: Courier New,monospace; font-size: 12px;">**FileStream** <span style="font-family: Verdana,sans-serif; font-size: 12px;">.
 * <span style="font-family: Verdana,sans-serif; font-size: 12px;"><span style="font-family: Verdana,sans-serif;">**FileStream** permette l'accesso diretto (random access) al file attraverso il metodo seek. Questa classe fornisce direttamente un file con stream associato.
 * <span style="display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">**BinaryReader** legge dati binari da uno stream. Permette anche la lettura di stringhe.
 * <span style="display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">**BinaryWriter** scrive dati binari in uno stream. Permette anche la scrittura di stringhe.
 * <span style="font-family: Verdana,sans-serif; font-size: 12px;">**StreamReader** legge byte da uno stream e li converte in caratteri usando Encoding.
 * <span style="font-family: Verdana,sans-serif; font-size: 12px;">**StreamWriter** scrive caratteri in uno stream e li converte in byte usando Encoding
 * <span style="display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">**StringReader** legge caratteri da una stringa. Questa classe permette di trattare una stringa come una sorgente di dati e usare le stesse API degli stream
 * <span style="display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">**StringWriter** scrive caratteri in una stringa. Stesso discorso di StringReader e le API degli stream.

<span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">**Rassegna delle classi fondamentali per i file :** > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;"> <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**tipo_restituito metodo** <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**FileStream** Create(string nomeFile), <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;"><span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">OpenWrite(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">OpenRead(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Open(string nomeFile, FileMode., FileAccess.) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**StreamWriter** AppendText(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">CreateText(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**StreamReader** OpenText(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**void** Copy(string daNome, string aNome) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Delete(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Exists(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Decrypt(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Encrypt(string nomeFile) <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;"><span style="font-family: Courier New,monospace; font-size: 12px;"> Move(string daNome, stringaNome) <span style="font-family: Verdana,sans-serif; font-size: 12px;"> serveanche per rinomiare il file <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">GetAttributes(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">SetAttributes(string nomeFile)
 * <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"><span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**File** <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;"> è una classe che offre **metodi e proprietà statici**, perciò è una classe comoda e veloce.

<span style="font-family: Verdana,sans-serif; font-size: 12px;">La classe <span style="font-family: Courier New,monospace; font-size: 12px;">File <span style="font-family: Verdana,sans-serif; font-size: 12px;"> fornisce una serie addizionale di metodi utili che: "//aprono// – //leggono/scrivono// - //chiudono//" il file e che quindi non restituiscono alcuno stream: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">String ReadAllText(string nomeFile) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void WriteAllText(string nomeFile, string testoDaScrivere) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void AppendAllText(string nomeFile, string testoDaAggiungere) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Byte[] ReadAllBytes(string nomeFile) <span style="font-family: Courier New,monospace; font-size: 12px;">void WriteAllBytes(string nomeFile, Byte[] bytesDaScrivere) <span style="font-family: Verdana,sans-serif; font-size: 12px;">e altre > Costruttori: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">FileInfo(string nomeFile); > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Proprietà: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">Exists, Length, FullName, Name, DirectoryName, Extension, Attributes <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">(get, set) > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;"> <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**tipo_restituito metodo** <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**FileStream** Create <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Open(FileMode., FileAccess.) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">OpenRead <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">OpenWrite <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**StreamWrite** CreateText <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">AppendText <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**StreamReader** OpenText <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">**void** Delete <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">CopyTo(string aNome) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Decrypt <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">Encrypt <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">MoveTo(string aNome) > <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"> Costruttori: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">FileStream(string nomeFile, FileMode., FileAccess.); > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Proprietà: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">CanRead, CanWrite, CanSeek, Length <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">(get) <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">, Position <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">(get/set) > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">int Read(byte[] array**,** int offset, int quanti) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">int ReadByte <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Write(byte[] array, int offset, int quanti) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void WriteByte(byte) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">long Seek(offset, SeekOrigin.) restituisce nuova posizione <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void CopyTo(Stream) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Flush <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Lock(long da, long quantiByte) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Unlock(long da, long quantiByte) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Close <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void SetLength(Int64 dimensione)
 * <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"><span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**FileInfo** <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;"> è una classe che offre **metodi e proprietà d'istanza**, perciò è una classe flessibile.
 * <span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**FileStream**

<span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;"> NOTA CURIOSA: con la <span style="font-family: Courier New,monospace; font-size: 12px;">Seek si può andare al di là della fine del file. In questo caso il file viene ingrandito. Da Windows NT in avanti, il file viene ingrandito aggiungendo zeri; in Windows 98 e precedenti, il file viene ingrandito senza azzerare i vecchi dati (?!) che quindi risultano visibili. > <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"> Costruttori: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">BinaryReader(Stream) > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Close <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">int PeekChar <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">int Read <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">int Read(Byte[] array, int offset, int quanti) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">bool ReadBoolean <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">byte ReadByte <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">char ReadChar <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">string ReadString <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">decimal ReadDecimal <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">double ReadDouble, ... > <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"><span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Costruttori: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">BinaryWriter, BinaryWriter(Stream) > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Close <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Flush <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">long Seek(int offset, SeekOrigin.) restituisce la nuova posizione <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Write(Boolean) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">void Write(byte | Char | Decimal | Double | String, |Byte[], ...)
 * <span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**BinaryReader**
 * <span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**BinaryWriter**

<span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">Libreria di riferimento: <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: justify;">http://msdn.microsoft.com/en-us/library/29kt2zfk.aspx <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">E' ora di diventare operativi. Si consulti la documentazione sui **file** e si implementino le seguenti attività:
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Verificare l'esistenza di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Creazione di un file di testo
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Scrivere un file di testo
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Scrivere in un file binario
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Leggere da un file di testo
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Leggere da un file binario
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Aggiungere testo ad un file di testo
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Rinominare un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Spostare un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Eliminare un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Copiare un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Ottenere la dimensione di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Ottenere gli attributi di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Impostare gli attributi di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Recuperare l'estensione di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Cambiare l'estensione di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Recuperare il percorso completo di un file
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Recuperare il nome di un file da un percorso

<span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">**Rassegna delle classi fondamentali per le Directory ** > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">DirectoryInfo CreateDirectory(string nomeDirectory) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">void Delete(string nomeDirectory) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">bool Exists(string nomeDirectory) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">void Move(string daNomeDirectory, string aNomeDirectory), <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">Ienumerable EnumerateDirectories( tring nomeDirectory) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">Ienumerable EnumerateFiles(string nomeDirectory), <span style="display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: left;"><span style="font-family: Courier New,monospace; font-size: 12px;">string[] GetDirectories( <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">string nomeDirectory <span style="font-family: Courier New,monospace; font-size: 12px;">) <span style="display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">string[] GetFiles( string nomeDirectory ) > Costruttori: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">DirectoryInfo(string nomeDirectory); > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Proprietà: <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">Exists, FullName, Name, Parent, Root, Attributes <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">(get, set), <span style="color: #000000; font-family: Courier New,monospace; font-size: 12px;">FullPath > <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;">Metodi <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">void Create <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">void Delete <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">void MoveTo(string aNomeDirectory), <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">Ienumerable EnumerateDirectories <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">Ienumerable EnumerateFiles <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">DirectoryInfo[] GetDirectories(string patternCercato) <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">FileInfo[] GetFiles restituisce l'elenco dei file nella directory corrente <span style="color: #000000; display: block; font-family: Courier New,monospace; font-size: 12px; text-align: left;">FileInfo[] GetFiles(string patternCercato) nella directory corrente <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 14.6667px; text-align: justify;">Attività comuni sulle **directory** da implementare con programmi:
 * <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"><span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**Directory** <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;"> è una classe che offre **metodi e proprietà statici**, perciò è una classe comoda e veloce.
 * <span style="font-family: Verdana,sans-serif; font-size: 14.6667px;"><span style="color: #000000; font-family: Courier New,monospace; font-size: 14.6667px;">**DirectoryInfo** <span style="color: #000000; font-family: Verdana,sans-serif; font-size: 12px;"> è una classe che offre **metodi e proprietà di istanza**, perciò è una classe flessibile.
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Verificare se una directory esiste
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Rinominare una directory
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Spostare una directory
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Creare una directory
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Copiare una directory
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Eliminare una directory
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Creare una sottodirectory
 * <span style="color: #000000; display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Visualizzare i file in una directory
 * <span style="display: block; font-family: Verdana,sans-serif; font-size: 12px; text-align: justify;">Visualizzare i file in una sottodirectory