Quantcast
Channel: Answers for "How important is it to wrap temp variables/objects in a "using" block?"
Viewing all articles
Browse latest Browse all 8

Answer by nsejosh

$
0
0
All "using" does is call Dispose on the included variables when the using block goes out of scope, assuming those objects implement IDisposable. It has _nothing_ to do with triggering garbage collection whatsoever. If you're curious about whether "using" will affect your memory footprint for a certain object, check if it implements IDisposable and thus needs nonmanaged resources released. Here is a nice clear explanation: http://www.dotnetperls.com/using If you find any documentation to the contrary from a reliable source ( i.e. Microsoft or Mono ) please post it.

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>