title: Read Introduction in C# - how to protect against it?
body: <p>An <a href="http://msdn.microsoft.com/en-us/magazine/jj883956.aspx">article</a> in MSDN Magazine discusses the notion of Read Introduction and gives a code sample which can be broken by it.</p>
  
  <pre><code>public class ReadIntro {
    private Object _obj = new Object();
    void PrintObj() {
      Object obj = _obj;
      if (obj != null) {
        Console.WriteLine(obj.ToString()); // May throw a NullReferenceException
      }
    }
    void Uninitialize() {
      _obj = null;
    }
  }
  </code></pre>
  
  <p>Notice this "May throw a NullReferenceException" comment - I never knew this was possible.</p>
  
  <p>So my question is: how can I protect against read introduction?</p>
  
  <p>I would also be really grateful for an explanation exactly when the compiler decides to introduce reads, because the article doesn't include it.</p>