Garbage collection of static members

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

Will static members be ever collected by the garbage collector?

4条回答
  •  一向
    一向 (楼主)
    2020-12-10 06:21

    A static member to a reference type is a reference, which may or may not point to an instance. If it points to an instance, said instance will not be collected until the static member is unloaded. If the type is loaded in a specific AppDomain, that can be unloaded. Otherwise it only happens when the application is terminated.

提交回复
热议问题