RE: The shocking truth about the C# lock statement

OK, so my example was a bit contrived.  In most cases what we do in our critical sections would be more than just adding to a List<>.  And in those cases, if an exception is thrown, we would hold the lock.   The next thought that came from that was that if you use an established pattern (lock), then why mix?   I believe that you should use the right tool for the right job.   I will have to chew on this more before I acquiesce on this point, however.   I would like to hear other opinions.

Advertisement

About JohnHowell

I am a professional software developer with over 20 years of experience. I currently specialize in Microsoft technologies such as VS, TFS, C#, VB.Net, WCF, WPF, WW, etc.
This entry was posted in Performance. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s