Does calling Clear disposes the items also?

前端 未结 4 1598
予麋鹿
予麋鹿 2021-01-07 19:54

Many times there is a clear method, that removes all the items from the collections, are these items disposed also.

Like,

toolStripMenuItem.DropDown         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-07 20:42

    I don't think so,more, it can cause many logical problems because you may have reference to that object in the collection for later use. If you don't have references to that objects Garbage Collector will dispose that objects later

提交回复
热议问题