This is not a good example; OpenFileDialog already has all the resources when the dialog closes. And this is a component, not a control. However, this implementation detail. In general, calling ShowDialog () does not automatically delete the form object. Unlike Show (). This is necessary to get the results of the dialog without fear of an ObjectDisposedException. Now itβs important that you dispose of it yourself after that.
Which facilitates the use of instructions.
Hans passant
source share