Whats the utility of public constructors in abstract classes in C#?

Absolutely correct. You should favor the protected constructor.

EDIT: no the compiler doesn’t complain, but tools like FxCop (& Code Analysis) do. I believe there are some weird reflection tricks you can do with public constructors on abstract classes, but from a standpoint where you are merely providing base class functionality to other developers writing subclasses, stick with the protected constructor.

Leave a Comment