Well in this exact example, the effect is useless locking. Perhaps you have a better example?
> -----Original Message----- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of Eddie Lascu > Sent: Thursday, August 10, 2006 4:25 PM > To: [email protected] > Subject: [ADVANCED-DOTNET] Multithread-safe classes > > I want to make my class multithread safe. What's the effect of writing > something like this: > > public sealed class MyClass > { > public MyClass(string strValue) > { > strMyField_ = strValue; > } > > public string MyField > { > get > { > lock(this) > { > return strMyFieldId_; > } > } > } > > string strMyField_; > } > > I know "lock" injects the "finally" block into the CIL, but is that > executed > if the return is before? =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
