EndOfStreamExceptionExtensions Class

Provides ThrowNew extension methods for EndOfStreamException.

public static class EndOfStreamExceptionExtensions

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 EndOfStreamException.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
EndOfStreamException.ThrowNew()Throws a new EndOfStreamException.
EndOfStreamException.ThrowNew(string?)Throws a new EndOfStreamException.
EndOfStreamException.ThrowNew(string?, Exception?)Throws a new EndOfStreamException.
EndOfStreamException.ThrowNew<T>()Throws a new EndOfStreamException, where the code needs an expression of type T.
EndOfStreamException.ThrowNew<T>(string?)Throws a new EndOfStreamException, where the code needs an expression of type T.
EndOfStreamException.ThrowNew<T>(string?, Exception?)Throws a new EndOfStreamException, where the code needs an expression of type T.

EndOfStreamException.ThrowNew overloads

EndOfStreamException.ThrowNew()

Throws a new EndOfStreamException.

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

EndOfStreamException.ThrowNew(string?)

Throws a new EndOfStreamException.

extension(EndOfStreamException)
{
    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.

EndOfStreamException.ThrowNew(string?, Exception?)

Throws a new EndOfStreamException.

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

EndOfStreamException.ThrowNew<T>()

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

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

T This method does not return.

EndOfStreamException.ThrowNew<T>(string?)

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

extension(EndOfStreamException)
{
    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.

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

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

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