ReSharper coolness of the day: generated constructor visibility

If you use ReSharper‘s Alt+Ins to generate a constructor, and you’re in an abstract class, ReSharper is automatically smart enough to make the constructor protected.

This only makes sense. After all, .NET design guidelines recommend that abstract classes shouldn’t have public constructors — you can’t instantiate the class, so while a public constructor is harmless, it’s also misleading.

But… no matter how much sense it makes, it’s cool. It’s one of those little details that make me like ReSharper so much.

Addendum: when you use Alt+Enter to change the constructor’s visibility, public isn’t even on the list. Nice touch.

Leave a Reply

Your email address will not be published. Required fields are marked *