C
Cor Ligthert[MVP]
Brian,
Because you and some others here wrote that unrestricted "every" class that
holds a dispose method is a warning that it "must" call the dispose method
I did not write that, I've written what you now wrote here more times, now
you come with reflector and not with an sample,
Cor
Why would we want to use 'using' on Windows Forms controls? First,
they're almost always class members which makes it impossible to use
'using' in semantically correct way. Second, the Dispose method is
already called automatically by the various control containers. And I
might add that the Form class does implement the IDisposable correctly
here. That is, it's own Dispose method recursively calls Dispose on
it's constituent IDisposable members. So unless you have some one-off
case where the lifetime of the control is not tied to the lifetime of
the containing Form then there's no reason to inject a second
superfulous call to Dispose.
You said you wanted an example. Use Reflector to see what
Form.Dispose is doing. You should be able to convince yourself that
the Dispose method really is called on the Windows Forms controls.
Because you and some others here wrote that unrestricted "every" class that
holds a dispose method is a warning that it "must" call the dispose method
I did not write that, I've written what you now wrote here more times, now
you come with reflector and not with an sample,
Cor
Michel,
In my idea have I asked you earlier to show us a sample where you use the
using on the controls on a form.
They all implements Idisposable.
Labels, Comboboxes, textboxes, tooltips, I've showed you that list in a
previous message.
I really am awaiting expecting full to see that done with using?
In my idea it will looks like a mesh, but I am always glad to be
surprised.
Cor
Why would we want to use 'using' on Windows Forms controls? First,
they're almost always class members which makes it impossible to use
'using' in semantically correct way. Second, the Dispose method is
already called automatically by the various control containers. And I
might add that the Form class does implement the IDisposable correctly
here. That is, it's own Dispose method recursively calls Dispose on
it's constituent IDisposable members. So unless you have some one-off
case where the lifetime of the control is not tied to the lifetime of
the containing Form then there's no reason to inject a second
superfulous call to Dispose.
You said you wanted an example. Use Reflector to see what
Form.Dispose is doing. You should be able to convince yourself that
the Dispose method really is called on the Windows Forms controls.