c# - Will an implicit variable in a using clause be garbage collected? -


In the following code, the named variable of type FU is a difficult reference for example, or the item is trash Weak for the collection?

 using  (new fu ()) {// something has been done here}   

The collected object is only a semaphore type of object But some reference calculates on, so that the code is not referenced in the block.

using hidden hidden locally scoded by holding the closing object Creates variable (this variable generates in the end section).

This prevents the variable object from being GCD.

You can do it.

Comments