다음을 통해 공유


DirectoryNotFoundException 생성자

정의

메시지 문자열을 사용하여 클래스의 DirectoryNotFoundException 새 인스턴스를 초기화합니다.

오버로드

Name Description
DirectoryNotFoundException()

메시지 문자열이 시스템 제공 메시지로 설정되고 HRESULT가 COR_E_DIRECTORYNOTFOUND 설정된 클래스의 DirectoryNotFoundException 새 인스턴스를 초기화합니다.

DirectoryNotFoundException(String)

메시지 문자열이 설정 message 되고 HRESULT가 DirectoryNotFoundException COR_E_DIRECTORYNOTFOUND 설정된 클래스의 새 인스턴스를 초기화합니다.

DirectoryNotFoundException(SerializationInfo, StreamingContext)
사용되지 않음.

지정된 serialization 및 컨텍스트 정보를 사용하여 클래스의 DirectoryNotFoundException 새 인스턴스를 초기화합니다.

DirectoryNotFoundException(String, Exception)

지정된 오류 메시지와 이 예외의 DirectoryNotFoundException 원인인 내부 예외에 대한 참조를 사용하여 클래스의 새 인스턴스를 초기화합니다.

DirectoryNotFoundException()

Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs

메시지 문자열이 시스템 제공 메시지로 설정되고 HRESULT가 COR_E_DIRECTORYNOTFOUND 설정된 클래스의 DirectoryNotFoundException 새 인스턴스를 초기화합니다.

public:
 DirectoryNotFoundException();
public DirectoryNotFoundException();
Public Sub New ()

예제

다음 코드 예제에서는 생성자를 호출 DirectoryNotFoundException 하는 방법을 보여 줍니다.

using System;
using System.IO;

class Program
{

    static void Main(string[] args)
    {
        try
        {

            //  Specify a directory name that does not exist for this demo.
            string dir = @"c:\78fe9lk";

            // If this directory does not exist, a DirectoryNotFoundException is thrown
            // when attempting to set the current directory.
            Directory.SetCurrentDirectory(dir);
        }
        catch (DirectoryNotFoundException dirEx)
        {
            // Let the user know that the directory did not exist.
            Console.WriteLine("Directory not found: " + dirEx.Message);
        }
    }
}
Imports System.IO

Module Module1
    Sub Main()
        Try

            ' Specify a directory name that does not exist for this demo.
            Dim dir As String = "c:\78fe9lk"

            ' If this directory does not exist, a DirectoryNotFoundException is thrown
            ' when attempting to set the current directory.
            Directory.SetCurrentDirectory(dir)

        Catch ex As System.IO.DirectoryNotFoundException

            ' Let the user know that the directory did not exist.
            Console.WriteLine("Directory not found: " + ex.Message)
        End Try
    End Sub
End Module

설명

이 생성자는 "지정된 디렉터리를 찾을 수 없습니다."와 같은 오류를 설명하는 시스템 제공 메시지로 새 인스턴스의 속성을 초기화 Exception.Message 합니다. 이 메시지는 현재 시스템 문화권을 고려합니다.

Exception.InnerException 새 인스턴스의 속성이 .로 null초기화됩니다.

추가 정보

적용 대상

DirectoryNotFoundException(String)

Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs

메시지 문자열이 설정 message 되고 HRESULT가 DirectoryNotFoundException COR_E_DIRECTORYNOTFOUND 설정된 클래스의 새 인스턴스를 초기화합니다.

public:
 DirectoryNotFoundException(System::String ^ message);
public DirectoryNotFoundException(string message);
public DirectoryNotFoundException(string? message);
new System.IO.DirectoryNotFoundException : string -> System.IO.DirectoryNotFoundException
Public Sub New (message As String)

매개 변수

message
String

오류를 설명하는 A String 입니다. 콘텐츠 message 는 인간이 이해할 수 있도록 고안되었습니다. 이 문자열이 현재 시스템 문화권에 맞게 지역화되었는지 확인하려면 이 생성자의 호출자가 필요합니다.

설명

이 생성자는 .를 Exception.Message 사용하여 message새 인스턴스의 속성을 초기화합니다.

Exception.InnerException 새 인스턴스의 속성이 .로 null초기화됩니다.

추가 정보

적용 대상

DirectoryNotFoundException(SerializationInfo, StreamingContext)

Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs

주의

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

지정된 serialization 및 컨텍스트 정보를 사용하여 클래스의 DirectoryNotFoundException 새 인스턴스를 초기화합니다.

protected:
 DirectoryNotFoundException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected DirectoryNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected DirectoryNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.IO.DirectoryNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.DirectoryNotFoundException
new System.IO.DirectoryNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.DirectoryNotFoundException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

매개 변수

info
SerializationInfo

throw되는 예외에 대한 직렬화된 개체 데이터를 보유하는 SerializationInfo.

context
StreamingContext

원본 또는 대상에 대한 컨텍스트 정보가 포함된 StreamingContext.

특성

추가 정보

적용 대상

DirectoryNotFoundException(String, Exception)

Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs
Source:
DirectoryNotFoundException.cs

지정된 오류 메시지와 이 예외의 DirectoryNotFoundException 원인인 내부 예외에 대한 참조를 사용하여 클래스의 새 인스턴스를 초기화합니다.

public:
 DirectoryNotFoundException(System::String ^ message, Exception ^ innerException);
public DirectoryNotFoundException(string message, Exception innerException);
public DirectoryNotFoundException(string? message, Exception? innerException);
new System.IO.DirectoryNotFoundException : string * Exception -> System.IO.DirectoryNotFoundException
Public Sub New (message As String, innerException As Exception)

매개 변수

message
String

예외의 이유를 설명하는 오류 메시지입니다.

innerException
Exception

현재 예외의 원인인 예외입니다. 매개 변수가 innerException 아닌 null경우 내부 예외를 catch 처리하는 블록에서 현재 예외가 발생합니다.

설명

이전 예외의 직접적인 결과로 throw되는 예외에는 속성의 이전 예외에 대한 참조가 InnerException 포함되어야 합니다. 속성 생성 InnerException 자에 전달 되는 동일한 값을 반환 하거나 null 속성 생성자에 내부 예외 값을 제공 하지 않는 경우 InnerException .

다음 표에서는 인스턴스 DirectoryNotFoundException에 대한 초기 속성 값을 보여 줍니다.

재산 가치
InnerException 내부 예외 참조입니다.
Message 오류 메시지 문자열입니다.

추가 정보

적용 대상