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

Reply via email to