IOException-Klasse

Die Ausnahme, die ausgelöst wird, wenn ein E/A-Fehler auftritt.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class IOException
    Inherits SystemException
'Usage
Dim instance As IOException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public class IOException : SystemException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class IOException : public SystemException
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class IOException extends SystemException
SerializableAttribute 
ComVisibleAttribute(true) 
public class IOException extends SystemException

Hinweise

IOException ist die Basisklasse für Ausnahmen, die beim Zugreifen auf Informationen mit Streams, Dateien und Verzeichnissen ausgelöst werden.

Die Basisklassenbibliothek enthält die folgenden Typen, die jeweils eine abgeleitete Klasse von IOException sind:

Verwenden Sie ggf. diese Typen anstelle von IOException.

IOException verwendet HRESULT COR_E_IO mit dem Wert 0x80131620.

Beispiel

Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die FileStream.Lock-Methode.

' Catch the IOException generated if the 
' specified part of the file is locked.
Catch ex As IOException
    Console.WriteLine( _
        "{0}: The write operation could " & _
        "not be performed because the " & _
        "specified part of the file is " & _
        "locked.", ex.GetType().Name)
End Try
// 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()->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());
}

Vererbungshierarchie

System.Object
   System.Exception
     System.SystemException
      System.IO.IOException
         Abgeleitete Klassen

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

IOException-Member
System.IO-Namespace
Exception

Weitere Ressourcen

Behandeln und Auslösen von Ausnahmen
Datei- und Stream-E/A
Gewusst wie: Lesen aus einer Textdatei
Gewusst wie: Schreiben von Text in eine Datei