I always missed a built-in exception type in c# which would indicate that an object is corrupted. What do you throw in such cases?
Usually I miss it when I realize that a method, that is supposed to work on an object, would fail if the object had a certain state. In such situations I often suspect that this state probably won't be ever reached. But being defensive about it, I'd like to throw an exception just in case it will (e.g. after a future code change).
For method arguments we have
case SomeType.A: doSomething(); break;
case SomeType.B: doSomethingElse(); break;
// Unexpected type! Someone introduced a new type and didn't update this.
throw new IllegalStateException("Unknown type "+this._someType);
You should throw
InvalidOperationException to indicate that an object has invalid state.
From the MSDN documentation (linked above):
The exception that is thrown when a method call is invalid for the object's current state.