NotSupportedException

NotSupportedException doesn’t indicate an implementation of an operation is not present; instead, it means the operation doesn’t make sense to implement. You might wonder why the operation isn’t just omitted in such a case, but often you don’t have a choice but to provide it when an interface is implemented or a base class has to be used.

Examples of the use of this exception type can be found in the System.IO namespace when dealing with Stream objects that do not support certain operations, such as Seek. It’s not uncommon for custom derived stream objects to support only a fraction of the base class’s functionality, hence warranting the use of NotSupportedException to indicate the missing functionality.

Another place where ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.