语言

FileNotFoundException 构造函数

定义

使用可选的消息字符串和内部FileNotFoundException引用初始化类的新实例Exception。

重载

名称 说明
FileNotFoundException()

使用其消息字符串设置为系统提供的消息初始化类的新实例 FileNotFoundException 。

FileNotFoundException(String)

使用指定的错误消息初始化类的新实例 FileNotFoundException 。

FileNotFoundException(SerializationInfo, StreamingContext)
已过时.

使用指定的序列化和上下文信息初始化 FileNotFoundException 类的新实例。

FileNotFoundException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用初始化 FileNotFoundException 类的新实例。

FileNotFoundException(String, String)

使用指定的错误消息和找不到的文件名初始化类的新实例 FileNotFoundException 。

FileNotFoundException(String, String, Exception)

使用指定的错误消息、找不到的文件名以及对此异常原因的内部异常的引用初始化类的新实例 FileNotFoundException 。

FileNotFoundException()

Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs

使用其消息字符串设置为系统提供的消息初始化类的新实例 FileNotFoundException 。

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

注解

此构造函数将 Message 新实例的属性初始化为系统提供的消息,该消息描述错误,例如“找不到指定的文件”。此消息将考虑当前系统区域性。

另请参阅

适用于

FileNotFoundException(String)

Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs

使用指定的错误消息初始化类的新实例 FileNotFoundException 。

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

参数

message
String

对错误的说明。 message 的内容旨在由人类理解。 此构造函数的调用方必须确保此字符串已本地化为当前系统区域性。

注解

此构造函数使用 Message.. 初始化message新实例的属性。

另请参阅

适用于

FileNotFoundException(SerializationInfo, StreamingContext)

Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs

注意

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

使用指定的序列化和上下文信息初始化 FileNotFoundException 类的新实例。

protected:
 FileNotFoundException(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 FileNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected FileNotFoundException(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.FileNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.FileNotFoundException
new System.IO.FileNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.FileNotFoundException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

保存所引发异常的序列化对象数据的对象。

context
StreamingContext

包含有关源或目标的上下文信息的对象。

特性

另请参阅

适用于

FileNotFoundException(String, Exception)

Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs

使用指定的错误消息和对作为此异常原因的内部异常的引用初始化 FileNotFoundException 类的新实例。

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

参数

message
String

对错误的说明。 message 的内容旨在由人类理解。 此构造函数的调用方必须确保此字符串已本地化为当前系统区域性。

innerException
Exception

是当前异常原因的异常。 如果未 innerExceptionnull 参数,则会在处理内部异常的 catch 块中引发当前异常。

注解

作为上一个异常的直接结果引发的异常应包括对 InnerException 属性中上一个异常的引用。 InnerException 属性返回传入构造函数的相同值,或者如果 null 属性未向构造函数提供内部异常值,则返回 InnerException。

下表显示了 FileNotFoundException实例的初始属性值。

财产 价值
InnerException 内部异常引用。
Message 错误消息字符串。

有关内部异常的详细信息,请参阅 InnerException。

另请参阅

适用于

FileNotFoundException(String, String)

Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs

使用指定的错误消息和找不到的文件名初始化类的新实例 FileNotFoundException 。

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

参数

message
String

错误的说明,或使用 null 给定消息的系统提供的消息 fileName。 人类应该理解的内容 message 。 此构造函数的调用方必须确保此字符串已本地化为当前系统区域性。

fileName
String

具有无效映像的文件全名。

注解

构造函数使用Message和使用该message属性初始化新实例FileNamefileName的属性。

另请参阅

适用于

FileNotFoundException(String, String, Exception)

Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs
Source:
FileNotFoundException.cs

使用指定的错误消息、找不到的文件名以及对此异常原因的内部异常的引用初始化类的新实例 FileNotFoundException 。

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

参数

message
String

解释异常原因的错误消息。

fileName
String

具有无效映像的文件全名。

innerException
Exception

是当前异常原因的异常。 如果未 innerExceptionnull 参数,则会在处理内部异常的 catch 块中引发当前异常。

注解

作为上一个异常的直接结果引发的异常应包括对 InnerException 属性中上一个异常的引用。 InnerException 属性返回传入构造函数的相同值,或者如果 null 属性未向构造函数提供内部异常值,则返回 InnerException。

下表显示了 FileNotFoundException实例的初始属性值。

财产 价值
InnerException 内部异常引用。
Message 错误消息字符串。

有关内部异常的详细信息,请参阅 InnerException。

另请参阅

适用于