In the Dispose(bool) method implementation, Shouldn't one set members to null?

后端 未结 3 687
一个人的身影
一个人的身影 2021-01-14 00:46

None of the guides/notes/articles that discuss IDisposable pattern suggest that one should set the internal members to null in the Dispose(bo

3条回答
  •  时光说笑
    2021-01-14 01:23

    Well, generally, it's not going to make a difference. The only place where it will make a difference is when you have a reference to an object on the Large Object Heap, the behavior of which you have seen already).

    There is a good article on the LOH which goes into this in more detail here:

    http://msdn.microsoft.com/en-us/magazine/cc534993.aspx

提交回复
热议问题