TYPE

InvalidOperationException

Represents an operation that is invalid for the current state.

Formal Syntax & Structure

csharp syntaxcsharp
new InvalidOperationException(string message)

Working Example

Example Snippetcsharp
throw new InvalidOperationException("No capacity remains");
C# & .NET Reference