Setting Objects to Null/Nothing after use in .NET

后端 未结 15 2152
囚心锁ツ
囚心锁ツ 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:52

    The only time you should set a variable to null is when the variable does not go out of scope and you no longer need the data associated with it. Otherwise there is no need.

提交回复
热议问题