DirectoryNotFoundExceptionExtensions Class
Provides ThrowNew extension methods for DirectoryNotFoundException.
public static class DirectoryNotFoundExceptionExtensionsRemarks
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
DirectoryNotFoundException.ThrowNew overloads
DirectoryNotFoundException.ThrowNew()
Throws a new DirectoryNotFoundException.
extension(DirectoryNotFoundException)
{
public static void ThrowNew()
}DirectoryNotFoundException.ThrowNew(string?)
Throws a new DirectoryNotFoundException.
extension(DirectoryNotFoundException)
{
public static void ThrowNew(string? message)
}DirectoryNotFoundException.ThrowNew(string?, Exception?)
Throws a new DirectoryNotFoundException.
extension(DirectoryNotFoundException)
{
public static void ThrowNew(string? message, Exception? innerException)
}Parameters
messagestring?- The error message that explains the reason for the exception.
innerExceptionException?- The exception that is the cause of the current exception. If the
innerExceptionparameter is notnull, the current exception is raised in acatchblock that handles the inner exception.
DirectoryNotFoundException.ThrowNew(string?, string?)
Available in: net11.0(not available in the other target frameworks of the package)
Throws a new DirectoryNotFoundException.
extension(DirectoryNotFoundException)
{
public static void ThrowNew(string? message, string? directoryPath)
}DirectoryNotFoundException.ThrowNew(string?, string?, Exception?)
Available in: net11.0(not available in the other target frameworks of the package)
Throws a new DirectoryNotFoundException.
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
messagestring?directoryPathstring?innerExceptionException?
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
messagestring?- A
Stringthat describes the error. The content ofmessageis 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
messagestring?- The error message that explains the reason for the exception.
innerExceptionException?- The exception that is the cause of the current exception. If the
innerExceptionparameter is notnull, the current exception is raised in acatchblock 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)
}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
messagestring?directoryPathstring?innerExceptionException?
Returns
T This method does not return.