How deep does Controls.Clear() clean up?

前端 未结 2 1232
心在旅途
心在旅途 2021-02-20 16:57

I\'m using a TableLayoutPanel which is dynamically filled with other TablelayoutPanels.

Now I\'m wondering what happens when I call Table

2条回答
  •  青春惊慌失措
    2021-02-20 17:39

    There is a bit of confusion in your question. Clear() will remove references and objects will be collected by garbage collector.

    But, you are also using the word dispose. Cleared objects will not be disposed in the sense that their Dispose method will be called.

    Thus, if you are not using those objects anymore, and you want Dispose to be called on them, you have to do it yourself.

提交回复
热议问题