Questo argomento non è stato ancora valutato - Valuta questo argomento

Classe IOException

Aggiornamento: novembre 2007

Eccezione generata quando si verifica un errore di I/O.

Spazio dei nomi:  System.IO
Assembly:  mscorlib (in mscorlib.dll)
[SerializableAttribute]
[ComVisibleAttribute(true)]
public class IOException : SystemException
/** @attribute SerializableAttribute */ 
/** @attribute ComVisibleAttribute(true) */
public class IOException extends SystemException
public class IOException extends SystemException

IOException è la classe base per le eccezioni generate durante l'accesso a informazioni tramite flussi, file e directory.

La libreria di classi base include i tipi indicati di seguito, ciascuno dei quali è una classe derivata da IOException:

Dove opportuno, utilizzare questi tipi anziché IOException.

IOException utilizza HRESULT COR_E_IO, con valore 0x80131620.

Questo esempio di codice fa parte di un esempio più esaustivo fornito per il metodo FileStream.Lock.

// Catch the IOException generated if the 
// specified part of the file is locked.
catch(IOException e)
{
    Console.WriteLine(
        "{0}: The write operation could not " +
        "be performed because the specified " +
        "part of the file is locked.", 
        e.GetType().Name);
}


// Catch the IOException generated if the 
// specified part of the file is locked.
catch(IOException e) {                        
    Console.WriteLine(
        "{0}: The write operation could not "
        + "be performed because the specified "
        + "part of the file is locked.", 
        e.GetType().get_Name());
}


Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition , Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile per Smartphone, Windows Mobile per Pocket PC, Xbox 360

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

.NET Framework

Supportato in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supportato in: 3.5, 2.0, 1.0

XNA Framework

Supportato in: 2.0, 1.0
Il documento è risultato utile?
(1500 caratteri rimanenti)

Aggiunte alla community

AGGIUNGI
© 2013 Microsoft. Tutti i diritti riservati.