Garbage collection of static members

前端 未结 4 2053
逝去的感伤
逝去的感伤 2020-12-10 05:52

Will static members be ever collected by the garbage collector?

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 06:23

    Members are not collected... Objects are.
    So if you set the Ref. Type static member to null, any object it was previously pointing to would be collected. If not, it will hang around till the AppDomain goes down (Each AppDomain has its own set of static stuff)

提交回复
热议问题