DirectoryNotFoundException Oluşturucular
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
İ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 DirectoryNotFoundException HRESULT değerinin |
| DirectoryNotFoundException(SerializationInfo, StreamingContext) |
Geçersiz.
Belirtilen serileştirme ve bağlam bilgileriyle DirectoryNotFoundException sınıfının yeni bir örneğini başlatır. |
| DirectoryNotFoundException(String, Exception) |
Belirtilen bir hata iletisi ve bu özel durumun nedeni olan iç özel duruma başvuru ile DirectoryNotFoundException sınıfının yeni bir örneğini başlatır. |
| DirectoryNotFoundException(String, String) | |
| DirectoryNotFoundException(String, String, Exception) |
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.
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)
İleti dizesi olarak ve DirectoryNotFoundException HRESULT değerinin message 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
Hatayı açıklayan bir String.
message içeriğinin 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 Exception.Messageyeni örneğin özelliğini başlatırmessage.
Exception.InnerException Yeni örneğin özelliği olarak nullbaşlatılır.
Ayrıca bkz.
Şunlara uygulanır
DirectoryNotFoundException(SerializationInfo, StreamingContext)
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 DirectoryNotFoundException sınıfının yeni bir örneğini 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)
Belirtilen bir hata iletisi ve bu özel durumun nedeni olan iç özel duruma başvuru ile DirectoryNotFoundException sınıfının yeni bir örneğini 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 nulldeğilse, geçerli özel durum, iç özel durumu işleyen bir catch bloğunda oluşturulur.
Açıklamalar
Önceki bir özel durumun doğrudan sonucu olarak oluşan özel durum, InnerException özelliğindeki önceki özel duruma başvuru içermelidir.
InnerException özelliği oluşturucuya geçirilen değeri döndürür veya null özelliği oluşturucuya iç özel durum değeri sağlamazsa InnerException.
Aşağıdaki tabloda, DirectoryNotFoundExceptionörneğinin ilk özellik değerleri gösterilmektedir.
| Mülkiyet | Değer |
|---|---|
| InnerException | İç özel durum başvurusu. |
| Message | Hata iletisi dizesi. |
Ayrıca bkz.
- Exception
- özel durumları işleme ve oluşturma
- Dosya ve Akış G/Ç'si
- Dosyadan Metin Okuma
- Nasıl yapılır: Dosyaya Metin Yazma
Şunlara uygulanır
DirectoryNotFoundException(String, String)
public:
DirectoryNotFoundException(System::String ^ message, System::String ^ directoryPath);
public DirectoryNotFoundException(string? message, string? directoryPath);
new System.IO.DirectoryNotFoundException : string * string -> System.IO.DirectoryNotFoundException
Public Sub New (message As String, directoryPath As String)
Parametreler
- message
- String
- directoryPath
- String
Şunlara uygulanır
DirectoryNotFoundException(String, String, Exception)
public:
DirectoryNotFoundException(System::String ^ message, System::String ^ directoryPath, Exception ^ innerException);
public DirectoryNotFoundException(string? message, string? directoryPath, Exception? innerException);
new System.IO.DirectoryNotFoundException : string * string * Exception -> System.IO.DirectoryNotFoundException
Public Sub New (message As String, directoryPath As String, innerException As Exception)
Parametreler
- message
- String
- directoryPath
- String
- innerException
- Exception