Z
Zachary Turner
Hello,
I'm a bit new to .NET and WindowsForms, and I don't like it when I run
across something that I don't understand. So I'm hoping I can clear up
some info for myself here and maybe learn a little bit more in the
process.
So anyway, the ColumnHeader class implements IDisposable interface
indirectly through one of its base classes. When and where does
Dispose actually get called? I'm sure this applies to many aspects of
..NET and Windows Forms, but I ask about this because it's the specific
case the got me thinking about this. It's important to me because I
have a situation where I add and remove Column Headers from the list
view dynamically. In fact, I even allow the user to create new types
of columns, all at runtime. I thought maybe somewhere in the
Listview.Dispose source code it loops through its Columns collection
calling Dispose on everything, but then what about Columns that I
remove at runtime and aren't in in the ListView whenever
ListView.Dispose is called? And on that note, when IS ListView.Dispose
called anyway? Probably in another loop from UserControl.Dispose or
Form.Dispose, but when are those called? My code simply allocates a
new form, stores it in a member variable, and then forgets about it.
Likewise with all sample code I've seen in books and MSDN.
Is this something I shoudl be worrying about? Why does it need to
implement IDisposable anyway? What system resources are being held
under the hood for which a finalizer is insufficient?
Thanks, I hope my question is clear, it's a little hard to convey my
confusion.
Zach
I'm a bit new to .NET and WindowsForms, and I don't like it when I run
across something that I don't understand. So I'm hoping I can clear up
some info for myself here and maybe learn a little bit more in the
process.
So anyway, the ColumnHeader class implements IDisposable interface
indirectly through one of its base classes. When and where does
Dispose actually get called? I'm sure this applies to many aspects of
..NET and Windows Forms, but I ask about this because it's the specific
case the got me thinking about this. It's important to me because I
have a situation where I add and remove Column Headers from the list
view dynamically. In fact, I even allow the user to create new types
of columns, all at runtime. I thought maybe somewhere in the
Listview.Dispose source code it loops through its Columns collection
calling Dispose on everything, but then what about Columns that I
remove at runtime and aren't in in the ListView whenever
ListView.Dispose is called? And on that note, when IS ListView.Dispose
called anyway? Probably in another loop from UserControl.Dispose or
Form.Dispose, but when are those called? My code simply allocates a
new form, stores it in a member variable, and then forgets about it.
Likewise with all sample code I've seen in books and MSDN.
Is this something I shoudl be worrying about? Why does it need to
implement IDisposable anyway? What system resources are being held
under the hood for which a finalizer is insufficient?
Thanks, I hope my question is clear, it's a little hard to convey my
confusion.
Zach