Hacker News new | ask | show | jobs
by nomercy400 1339 days ago
Is this like java.lang.UnsupportedOperationException?
2 comments

No, that's System.NotSupportedException in .NET.
Which in turn is not for unreachable or even unexpected cases but expected cases you’re fully aware of, maybe even documented, but that you don’t support.
Yes, like Seek() on a NetworkStream.
In Java, usually an Error like AssertionError is used for those cases.

By example, for a switch on an enum, the compiler inserts a "throw new ...Error()" automatically when the default case is not specified.