Setting Objects to Null/Nothing after use in .NET

后端 未结 15 2294
囚心锁ツ
囚心锁ツ 2020-11-22 16:09

Should you set all the objects to null (Nothing in VB.NET) once you have finished with them?

I understand that in .NET it is essential to

15条回答
  •  不要未来只要你来
    2020-11-22 16:47

    Take a look at this article as well: http://www.codeproject.com/KB/cs/idisposable.aspx

    For the most part, setting an object to null has no effect. The only time you should be sure to do so is if you are working with a "large object", which is one larger than 84K in size (such as bitmaps).

提交回复
热议问题