FileNotFoundException FileNotFoundException FileNotFoundException FileNotFoundException Constructors

Definition

Overloads

FileNotFoundException() FileNotFoundException() FileNotFoundException()

Initializes a new instance of the FileNotFoundException class with its message string set to a system-supplied message.

FileNotFoundException(String) FileNotFoundException(String) FileNotFoundException(String) FileNotFoundException(String)

Initializes a new instance of the FileNotFoundException class with a specified error message.

FileNotFoundException(SerializationInfo, StreamingContext) FileNotFoundException(SerializationInfo, StreamingContext) FileNotFoundException(SerializationInfo, StreamingContext) FileNotFoundException(SerializationInfo, StreamingContext)

Initializes a new instance of the FileNotFoundException class with the specified serialization and context information.

FileNotFoundException(String, Exception) FileNotFoundException(String, Exception) FileNotFoundException(String, Exception) FileNotFoundException(String, Exception)

Initializes a new instance of the FileNotFoundException class with a specified error message and a reference to the inner exception that is the cause of this exception.

FileNotFoundException(String, String) FileNotFoundException(String, String) FileNotFoundException(String, String) FileNotFoundException(String, String)

Initializes a new instance of the FileNotFoundException class with a specified error message, and the file name that cannot be found.

FileNotFoundException(String, String, Exception) FileNotFoundException(String, String, Exception) FileNotFoundException(String, String, Exception) FileNotFoundException(String, String, Exception)

Initializes a new instance of the FileNotFoundException class with a specified error message, the file name that cannot be found, and a reference to the inner exception that is the cause of this exception.

FileNotFoundException() FileNotFoundException() FileNotFoundException()

Initializes a new instance of the FileNotFoundException class with its message string set to a system-supplied message.

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

Remarks

This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "Could not find the specified file." This message takes into account the current system culture.

See also

FileNotFoundException(String) FileNotFoundException(String) FileNotFoundException(String) FileNotFoundException(String)

Initializes a new instance of the FileNotFoundException class with a specified error message.

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

Parameters

message
String String String String

A description of the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

Remarks

This constructor initializes the Message property of the new instance using message.

See also

FileNotFoundException(SerializationInfo, StreamingContext) FileNotFoundException(SerializationInfo, StreamingContext) FileNotFoundException(SerializationInfo, StreamingContext) FileNotFoundException(SerializationInfo, StreamingContext)

Initializes a new instance of the FileNotFoundException class with the specified serialization and context information.

protected:
 FileNotFoundException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected FileNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.IO.FileNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.FileNotFoundException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo SerializationInfo SerializationInfo SerializationInfo

An object that holds the serialized object data about the exception being thrown.

context
StreamingContext StreamingContext StreamingContext StreamingContext

An object that contains contextual information about the source or destination.

See also

FileNotFoundException(String, Exception) FileNotFoundException(String, Exception) FileNotFoundException(String, Exception) FileNotFoundException(String, Exception)

Initializes a new instance of the FileNotFoundException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public:
 FileNotFoundException(System::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)

Parameters

message
String String String String

A description of the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

innerException
Exception Exception Exception Exception

The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

Remarks

An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. The InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

The following table shows the initial property values for an instance of FileNotFoundException.

Property Value
InnerException The inner exception reference.
Message The error message string.

For more information on inner exceptions, see InnerException.

See also

FileNotFoundException(String, String) FileNotFoundException(String, String) FileNotFoundException(String, String) FileNotFoundException(String, String)

Initializes a new instance of the FileNotFoundException class with a specified error message, and the file name that cannot be found.

public:
 FileNotFoundException(System::String ^ message, System::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)

Parameters

message
String String String String

A description of the error, or null to use a system-supplied message with the given fileName. The content of message should be understood by humans. The caller of this constructor must ensure that this string has been localized for the current system culture.

fileName
String String String String

The full name of the file with the invalid image.

Remarks

The constructor initializes the Message property of the new instance using message and the FileName property using fileName.

See also

FileNotFoundException(String, String, Exception) FileNotFoundException(String, String, Exception) FileNotFoundException(String, String, Exception) FileNotFoundException(String, String, Exception)

Initializes a new instance of the FileNotFoundException class with a specified error message, the file name that cannot be found, and a reference to the inner exception that is the cause of this exception.

public:
 FileNotFoundException(System::String ^ message, System::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)

Parameters

message
String String String String

The error message that explains the reason for the exception.

fileName
String String String String

The full name of the file with the invalid image.

innerException
Exception Exception Exception Exception

The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

Remarks

An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. The InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

The following table shows the initial property values for an instance of FileNotFoundException.

Property Value
InnerException The inner exception reference.
Message The error message string.

For more information on inner exceptions, see InnerException.

See also

Applies to