Welcome to MSDN Blogs Sign in | Join | Help

Using for purposes other than disposable objects...

Doug asks:

re: A lock statement with timeout...

I've done this trick before to deal with common patterns in numerous methods. Usually lock acquisition, but there are some others. Problem is it always feels like a hack since the object isn't really disposable so much as "call-back-at-the-end-of-a-scope-able".

Doug,

When we decided the using statement, we decided to name it “using” rather than something more specific to disposing objects so that it could be used for exactly this scenario.

Published Sunday, March 28, 2004 8:52 PM by ericgu
Filed under: ,

Comments

Sunday, March 28, 2004 10:02 PM by Doug McClean

# re: Using for purposes other than disposable objects...

Really? Cool. I don't feel as dirty anymore. :)

I will take that as license to keep doin' what I'm doin'.
Monday, March 29, 2004 1:27 AM by Something Clever

# Eric Gunnerson validates using

Eric Gunnerson (of the C# design team) says they planned for the use of using statements for purposes other than deterministic finalization of unmanaged resources.
Monday, March 29, 2004 1:58 AM by Something Clever

# Eric Gunnerson validates liberally using

Eric Gunnerson (of the C# design team) says they planned for the use of using statements for purposes other than deterministic finalization of unmanaged resources.
Thursday, June 03, 2004 11:05 AM by John

# re: Using for purposes other than disposable objects...

But that was a mistake wasn't it?
New Comments to this post are disabled
 
Page view tracker