FileNotFoundExceptionExtensions Class

Provides ThrowNew extension methods for FileNotFoundException.

public static class FileNotFoundExceptionExtensions

Remarks

Each public constructor of the exception type has two methods, with the parameters of the constructor. Call them on the exception type, as in FileNotFoundException.ThrowNew(message).

The first method returns no value. Call it as a statement.

The second method has a type parameter, which is also its return type. Call it where the code needs an expression of that type.

See also

Methods

NameDescription
FileNotFoundException.ThrowNew()Throws a new FileNotFoundException.
FileNotFoundException.ThrowNew(string?)Throws a new FileNotFoundException.
FileNotFoundException.ThrowNew(string?, Exception?)Throws a new FileNotFoundException.
FileNotFoundException.ThrowNew(string?, string?)Throws a new FileNotFoundException.
FileNotFoundException.ThrowNew(string?, string?, Exception?)Throws a new FileNotFoundException.
FileNotFoundException.ThrowNew<T>()Throws a new FileNotFoundException, where the code needs an expression of type T.
FileNotFoundException.ThrowNew<T>(string?)Throws a new FileNotFoundException, where the code needs an expression of type T.
FileNotFoundException.ThrowNew<T>(string?, Exception?)Throws a new FileNotFoundException, where the code needs an expression of type T.
FileNotFoundException.ThrowNew<T>(string?, string?)Throws a new FileNotFoundException, where the code needs an expression of type T.
FileNotFoundException.ThrowNew<T>(string?, string?, Exception?)Throws a new FileNotFoundException, where the code needs an expression of type T.

FileNotFoundException.ThrowNew overloads

FileNotFoundException.ThrowNew()

Throws a new FileNotFoundException.

extension(FileNotFoundException)
{
    public static void ThrowNew()
}

FileNotFoundException.ThrowNew(string?)

Throws a new FileNotFoundException.

extension(FileNotFoundException)
{
    public static void ThrowNew(string? message)
}
Parameters
message 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.

FileNotFoundException.ThrowNew(string?, Exception?)

Throws a new FileNotFoundException.

extension(FileNotFoundException)
{
    public static void ThrowNew(string? message, Exception? innerException)
}
Parameters
message 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?
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.

FileNotFoundException.ThrowNew(string?, string?)

Throws a new FileNotFoundException.

extension(FileNotFoundException)
{
    public static void ThrowNew(string? message, string? fileName)
}
Parameters
message 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?
The full name of the file with the invalid image.

FileNotFoundException.ThrowNew(string?, string?, Exception?)

Throws a new FileNotFoundException.

extension(FileNotFoundException)
{
    public static void ThrowNew(string? message, string? fileName, Exception? innerException)
}
Parameters
message string?
The error message that explains the reason for the exception.
fileName string?
The full name of the file with the invalid image.
innerException 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.

FileNotFoundException.ThrowNew<T>()

Throws a new FileNotFoundException, where the code needs an expression of type T.

extension(FileNotFoundException)
{
    public static T ThrowNew<T>()
}
Type parameters
T
The type of the expression.
Returns

T This method does not return.

FileNotFoundException.ThrowNew<T>(string?)

Throws a new FileNotFoundException, where the code needs an expression of type T.

extension(FileNotFoundException)
{
    public static T ThrowNew<T>(string? message)
}
Type parameters
T
The type of the expression.
Parameters
message 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.
Returns

T This method does not return.

FileNotFoundException.ThrowNew<T>(string?, Exception?)

Throws a new FileNotFoundException, where the code needs an expression of type T.

extension(FileNotFoundException)
{
    public static T ThrowNew<T>(string? message, Exception? innerException)
}
Type parameters
T
The type of the expression.
Parameters
message 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?
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.
Returns

T This method does not return.

FileNotFoundException.ThrowNew<T>(string?, string?)

Throws a new FileNotFoundException, where the code needs an expression of type T.

extension(FileNotFoundException)
{
    public static T ThrowNew<T>(string? message, string? fileName)
}
Type parameters
T
The type of the expression.
Parameters
message 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?
The full name of the file with the invalid image.
Returns

T This method does not return.

FileNotFoundException.ThrowNew<T>(string?, string?, Exception?)

Throws a new FileNotFoundException, where the code needs an expression of type T.

extension(FileNotFoundException)
{
    public static T ThrowNew<T>(string? message, string? fileName, Exception? innerException)
}
Type parameters
T
The type of the expression.
Parameters
message string?
The error message that explains the reason for the exception.
fileName string?
The full name of the file with the invalid image.
innerException 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.
Returns

T This method does not return.