Loops and Garbage Collection

后端 未结 5 1936
鱼传尺愫
鱼传尺愫 2021-01-13 13:31

I am working on a web application and I have run into the following situation.

Dim a as Object
Dim i as Integer = 0

Try

    For i=1 to 5

        a = new O         


        
5条回答
  •  暖寄归人
    2021-01-13 14:37

    No you don't need it. .NET has garbage collection. And since it looks like this code is in a method scope the garbage collection will clean up any local variables.

提交回复
热议问题