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

Answer by lil_billy

well im aware of the benefit of using using lol however i didnt know that C# handled garbage collection that way Knowing that bit now I would say yes you could get away with it however there would be...

View Article


Answer by Owen Reynolds

Not an expert, but USING isn't for garbage collection. It's for "special" things like files, to be absolutely sure the Close statement gets called in every single case. I'd guess that the actual memory...

View Article


Answer by Dave Carlile

Any object you create that references limited, external, non-managed resources - files likely being the most common - should be created with *using* to make sure those resources are released as soon as...

View Article

Answer by nsejosh

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...

View Article

Answer by lil_billy

well im aware of the benefit of using using lol however i didnt know that C# handled garbage collection that way Knowing that bit now I would say yes you could get away with it however there would be...

View Article


Answer by Owen-Reynolds

Not an expert, but USING isn't for garbage collection. It's for "special" things like files, to be absolutely sure the Close statement gets called in every single case. I'd guess that the actual memory...

View Article

Answer by Dave-Carlile

Any object you create that references limited, external, non-managed resources - files likely being the most common - should be created with *using* to make sure those resources are released as soon as...

View Article

Answer by nsejosh

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...

View Article

Browsing all 8 articles
Browse latest View live