Aracılığıyla paylaş


DirectoryNotFoundException Oluşturucular

Tanım

İleti dizesiyle sınıfının yeni bir örneğini DirectoryNotFoundException başlatır.

Aşırı Yüklemeler

Name Description
DirectoryNotFoundException()

İleti dizesi sistem tarafından sağlanan bir iletiye ve HRESULT COR_E_DIRECTORYNOTFOUND olarak ayarlanmış olarak sınıfın yeni bir örneğini DirectoryNotFoundException başlatır.

DirectoryNotFoundException(String)

İleti dizesi olarak ve message HRESULT değerinin DirectoryNotFoundException COR_E_DIRECTORYNOTFOUND olarak ayarlandığı sınıfın yeni bir örneğini başlatır.

DirectoryNotFoundException(SerializationInfo, StreamingContext)
Geçersiz.

Belirtilen serileştirme ve bağlam bilgileriyle sınıfının yeni bir örneğini DirectoryNotFoundException başlatır.

DirectoryNotFoundException(String, Exception)

Sınıfın DirectoryNotFoundException yeni bir örneğini belirtilen bir hata iletisiyle ve bu özel durumun nedeni olan iç özel duruma başvuruyla başlatır.

DirectoryNotFoundException()

Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs

İleti dizesi sistem tarafından sağlanan bir iletiye ve HRESULT COR_E_DIRECTORYNOTFOUND olarak ayarlanmış olarak sınıfın yeni bir örneğini DirectoryNotFoundException başlatır.

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

Örnekler

Aşağıdaki kod örneği oluşturucunun nasıl çağrılduğunu DirectoryNotFoundException gösterir.

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

Açıklamalar

Bu oluşturucu, "Belirtilen dizin bulunamadı" gibi hatayı açıklayan sistem tarafından sağlanan bir iletiye yeni örneğin özelliğini başlatır Exception.Message . Bu ileti geçerli sistem kültürünü dikkate alır.

Exception.InnerException Yeni örneğin özelliği olarak nullbaşlatılır.

Ayrıca bkz.

Şunlara uygulanır

DirectoryNotFoundException(String)

Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs

İleti dizesi olarak ve message HRESULT değerinin DirectoryNotFoundException COR_E_DIRECTORYNOTFOUND olarak ayarlandığı sınıfın yeni bir örneğini başlatır.

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)

Parametreler

message
String

String Hatanın açıklandığı bir. içeriğinin message insanlar tarafından anlaşılması amaçlanmıştır. Bu dizenin geçerli sistem kültürü için yerelleştirildiğinden emin olmak için bu oluşturucunun çağıranı gereklidir.

Açıklamalar

Bu oluşturucu kullanarak messageyeni örneğin özelliğini başlatırException.Message.

Exception.InnerException Yeni örneğin özelliği olarak nullbaşlatılır.

Ayrıca bkz.

Şunlara uygulanır

DirectoryNotFoundException(SerializationInfo, StreamingContext)

Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs

Dikkat

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

Belirtilen serileştirme ve bağlam bilgileriyle sınıfının yeni bir örneğini DirectoryNotFoundException başlatır.

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)

Parametreler

info
SerializationInfo

Oluşan SerializationInfo özel durumla ilgili serileştirilmiş nesne verilerini tutan.

context
StreamingContext

StreamingContext Kaynak veya hedef hakkında bağlamsal bilgileri içeren.

Öznitelikler

Ayrıca bkz.

Şunlara uygulanır

DirectoryNotFoundException(String, Exception)

Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs
Kaynak:
DirectoryNotFoundException.cs

Sınıfın DirectoryNotFoundException yeni bir örneğini belirtilen bir hata iletisiyle ve bu özel durumun nedeni olan iç özel duruma başvuruyla başlatır.

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)

Parametreler

message
String

Özel durumun nedenini açıklayan hata iletisi.

innerException
Exception

Geçerli özel durumun nedeni olan özel durum. innerException parametresi değilsenull, geçerli özel durum, iç özel durumu işleyen bir catch blokta oluşturulur.

Açıklamalar

Önceki bir özel durumun doğrudan sonucu olarak oluşan bir özel durum, özelliğindeki önceki özel duruma başvuru içermelidir InnerException . InnerException özelliği oluşturucuya geçirilen aynı değeri döndürür veya null özelliği oluşturucuya iç özel durum değeri sağlamaz.InnerException

Aşağıdaki tabloda, örneğinin ilk özellik değerleri gösterilmektedir DirectoryNotFoundException.

Mülkiyet Değer
InnerException İç özel durum başvurusu.
Message Hata iletisi dizesi.

Ayrıca bkz.

Şunlara uygulanır