One of the things that frequently annoys me about third party controls (including those built into the .NET Framework) are properties that either aren't virtual
, or don't have corresponding change events / virtual methods. Quite often I find myself wanting to perform an action when a property is changed, and if neither of those are present I end up having to create a custom version of the property, and as a rule, I don't like using the new
keyword unless there is no other alternative.
As a result of this, whenever I add properties to my WinForm controls, I tend to ensure they have a change event, and most often they are also virtual as I have a custom code snippet to build the boilerplate. That can mean some controls have an awful lot of events, many of which are rarely used.
This article describes how you can explicitly implement events to reduce the amount of memory your types take.