[Mono-list] Not implemented exceptions in Getters

Dave Curylo curylod at asme.org
Sat Jul 12 00:07:17 UTC 2014


On Friday, July 11, 2014, Kevin Connell <kevin at connells.net> wrote:

> Is throwing a NotImplementedExceptions  an appropriate pattern in a getter?
>
>
Not really an appropriate pattern, no. Which classes were these? Part of
the mono framework?

"Avoid throwing exceptions from property getters.
Property getters should be simple operations without any preconditions. If
a getter might throw an exception, consider redesigning the property to be
a method. This recommendation does not apply to indexers. Indexers can
throw exceptions because of invalid arguments."

>From http://msdn.microsoft.com/en-us/library/vstudio/ms229006(v=vs.100).aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140711/bffe443c/attachment.html>


More information about the Mono-list mailing list