I have seen examples of objects which are automatically disposed through the ‘using’ statement, which is a definitive way of defining the scope of the object and forcing a dispose.
I’ve also seen dispose called in the finally of a try/catch/finally block.
However, say the disposable object is instantiated as a property initializer in a form class how do I ensure that Dispose is called in that scenario?
You can get the Form to implement IDisposable and just call the Dispose() method on your object in your Form.Dispose()