다음을 통해 공유


IOException 클래스

I/O 오류가 발생할 때 throw되는 예외입니다.

네임스페이스: System.IO
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class IOException
    Inherits SystemException
‘사용 방법
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

설명

IOException은 스트림, 파일 및 디렉터리를 사용하여 정보에 액세스하는 동안 throw되는 예외에 대한 기본 클래스입니다.

기본 클래스 라이브러리는 각각 IOException의 파생된 클래스인 다음 형식을 포함합니다.

적절한 경우 IOException 대신 이러한 형식을 사용합니다.

IOException은 0x80131620 값을 가지는 HRESULT COR_E_IO를 사용합니다.

예제

이 코드 예제는 FileStream.Lock 메서드에 대해 제공되는 보다 큰 예제의 일부입니다.

' 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());
}

상속 계층 구조

System.Object
   System.Exception
     System.SystemException
      System.IO.IOException
         파생 클래스

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

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

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

IOException 멤버
System.IO 네임스페이스
Exception

기타 리소스

예외 처리 및 Throw
파일 및 스트림 I/O
방법: 파일의 텍스트 읽기
방법: 파일에 텍스트 쓰기