Dispose Pattern -- why void Dispose() is nonvirtual?

  • Thread starter Thread starter gz
  • Start date Start date
gz said:
Does anyone know the reason?

Once you've got a virtual Dispose(bool) method, there's no need for the
normal Dispose to remain virtual, and keeping it so could lead to
inappropriate implementations which didn't call base.Dispose() - or
which called Dispose(bool) themselves as well as base.Dispose().
 
Once you've got a virtual Dispose(bool) method, there's no need for the
normal Dispose to remain virtual, and keeping it so could lead to
inappropriate implementations which didn't call base.Dispose() - or
which called Dispose(bool) themselves as well as base.Dispose().

I see. Thanks.
 
Back
Top