title: How do you make a thread-safe static property?
body: <p>I have a CLR stored procedure defined in the below class. I am using property injection for MyObject but I'm not sure if it's thread-safe? Note: the CLR stored procedure needs to be static.</p>
  <pre><code>public class MyClass
  {
      private static IMyObject _myObj;
      public static IMyObject MyObject
      {
          get { return _myObj ?? new MyObject(); }
          set {_myObj = value; }
      }
  
      static MyClass()
      {
          _myObj = MyObject;
      }
  
      public static void My_Stored_Procedure()
      {
          _myObj.DoStuff();
      }
  }
  </code></pre>
  <p>Mainly the reason for adding the static property is for unit testing.</p>