Wann wird InvalidOperationException oder NotSupportedException verwendet?

Ich bin Implementierung einer custom collection-Implementierung, die entweder lese-oder non-readonly; das heißt, alle Methoden, die sich der Sammlung eine Funktion aufzurufen, ist das moralische äquivalent zu:

private void ThrowIfReadOnly() {
    if (this.isReadOnly)
       throw new SomeException("Cannot modify a readonly collection.");
}

Ich bin nicht sicher, welche der NotSupportedException oder InvalidOperationException sollte ich verwenden, in diesem Fall.

InformationsquelleAutor der Frage Jean Hominal | 2012-10-01

Schreibe einen Kommentar