DirectoryNotFoundExceptionExtensions Class

Provides ThrowNew extension methods for DirectoryNotFoundException.

public static class DirectoryNotFoundExceptionExtensions

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 DirectoryNotFoundException.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.

The methods with a directoryPath parameter are not available in the netstandard, .NET Framework, and .NET 10 builds of Louis, because the constructors with that parameter arrived with .NET 11.

See also

Methods

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

DirectoryNotFoundException.ThrowNew overloads

DirectoryNotFoundException.ThrowNew()

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

DirectoryNotFoundException.ThrowNew(string?)

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

DirectoryNotFoundException.ThrowNew(string?, Exception?)

extension(DirectoryNotFoundException)
{
    public static void ThrowNew(string? message, Exception? innerException)
}
Parameters
message string?
The error message that explains the reason for the exception.
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.

DirectoryNotFoundException.ThrowNew(string?, string?)

Available in: net11.0(not available in the other target frameworks of the package)

extension(DirectoryNotFoundException)
{
    public static void ThrowNew(string? message, string? directoryPath)
}

'M:System.IO.DirectoryNotFoundException.#ctor(System.String,System.String)' has no documentation.

Parameters
message string?
directoryPath string?

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

Available in: net11.0(not available in the other target frameworks of the package)

extension(DirectoryNotFoundException)
{
    public static void ThrowNew(string? message, string? directoryPath, Exception? innerException)
}

'M:System.IO.DirectoryNotFoundException.#ctor(System.String,System.String,System.Exception)' has no documentation.

Parameters
message string?
directoryPath string?
innerException Exception?

DirectoryNotFoundException.ThrowNew<T>()

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

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

T This method does not return.

DirectoryNotFoundException.ThrowNew<T>(string?)

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

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

T This method does not return.

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

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

extension(DirectoryNotFoundException)
{
    public static T ThrowNew<T>(string? message, Exception? innerException)
}
Type parameters
T
The type of the expression.
Parameters
message string?
The error message that explains the reason for the exception.
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.

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

Available in: net11.0(not available in the other target frameworks of the package)

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

extension(DirectoryNotFoundException)
{
    public static T ThrowNew<T>(string? message, string? directoryPath)
}

'M:System.IO.DirectoryNotFoundException.#ctor(System.String,System.String)' has no documentation.

Type parameters
T
The type of the expression.
Parameters
message string?
directoryPath string?
Returns

T This method does not return.

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

Available in: net11.0(not available in the other target frameworks of the package)

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

extension(DirectoryNotFoundException)
{
    public static T ThrowNew<T>(string? message, string? directoryPath, Exception? innerException)
}

'M:System.IO.DirectoryNotFoundException.#ctor(System.String,System.String,System.Exception)' has no documentation.

Type parameters
T
The type of the expression.
Parameters
message string?
directoryPath string?
innerException Exception?
Returns

T This method does not return.