Επεξεργασία

Κοινή χρήση μέσω


FileLoadException Constructors

Definition

Initializes a new instance of the FileLoadException class.

Overloads

FileLoadException()

Initializes a new instance of the FileLoadException class, setting the Message property of the new instance to a system-supplied message that describes the error, such as "Could not load the specified file." This message takes into account the current system culture.

FileLoadException(String)

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

FileLoadException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the FileLoadException class with serialized data.

FileLoadException(String, Exception)

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

FileLoadException(String, String)

Initializes a new instance of the FileLoadException class with a specified error message and the name of the file that could not be loaded.

FileLoadException(String, String, Exception)

Initializes a new instance of the FileLoadException class with a specified error message, the name of the file that could not be loaded, and a reference to the inner exception that is the cause of this exception.

FileLoadException()

Source:
FileLoadException.cs
Source:
FileLoadException.cs
Source:
FileLoadException.cs

Initializes a new instance of the FileLoadException class, setting the Message property of the new instance to a system-supplied message that describes the error, such as "Could not load the specified file." This message takes into account the current system culture.

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

Remarks

The InnerException property and FileName property of the new instance are initialized to null.

See also

Applies to

FileLoadException(String)

Source:
FileLoadException.cs
Source:
FileLoadException.cs
Source:
FileLoadException.cs

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

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

Parameters

message
String

A String that describes 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. The InnerException property and FileName property of the new instance are initialized to null.

See also

Applies to

FileLoadException(SerializationInfo, StreamingContext)

Source:
FileLoadException.cs
Source:
FileLoadException.cs
Source:
FileLoadException.cs

Caution

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

Initializes a new instance of the FileLoadException class with serialized data.

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

Parameters

info
SerializationInfo

The SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

The StreamingContext that contains contextual information about the source or destination.

Attributes

See also

Applies to

FileLoadException(String, Exception)

Source:
FileLoadException.cs
Source:
FileLoadException.cs
Source:
FileLoadException.cs

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

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

Parameters

message
String

A String that describes 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.

inner
Exception

The exception that is the cause of the current exception. If the inner 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 FileLoadException.

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

For more information on inner exceptions, see InnerException.

See also

Applies to

FileLoadException(String, String)

Source:
FileLoadException.cs
Source:
FileLoadException.cs
Source:
FileLoadException.cs

Initializes a new instance of the FileLoadException class with a specified error message and the name of the file that could not be loaded.

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

Parameters

message
String

A String that describes 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.

fileName
String

A String containing the name of the file that was not loaded.

Remarks

This constructor initializes the Message property of the new instance using message and the FileName property using fileName. The InnerException property of the new instance is initialized to null.

FileName is not required to be a file stored on disk; it can be any part of a system that supports access to streams. For example, depending on the system, this class might be able to access a physical device.

See also

Applies to

FileLoadException(String, String, Exception)

Source:
FileLoadException.cs
Source:
FileLoadException.cs
Source:
FileLoadException.cs

Initializes a new instance of the FileLoadException class with a specified error message, the name of the file that could not be loaded, and a reference to the inner exception that is the cause of this exception.

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

Parameters

message
String

A String that describes 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.

fileName
String

A String containing the name of the file that was not loaded.

inner
Exception

The exception that is the cause of the current exception. If the inner 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.

FileName is not required to be a file stored on disk; it can be any part of a system that supports access to streams. For example, depending on the system, this class might be able to access a physical device.

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

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

For more information on inner exceptions, see InnerException.

See also

Applies to