title: Why the singleton implementation in C# 6.0 does not need the beforefieldinit flag?
body: <p>I'm trying to understand why this is a correct implementation of the Singleton pattern:</p>
  
  <pre><code>public sealed class Singleton : ISingleton
  {
      public static Singleton Instance { get; } = new Singleton();
  
      private Singleton() { }
  
      // methods
  }
  </code></pre>
  
  <p>What about the <code>beforefieldinit</code> flag? According to Jon Skeet <a href="http://csharpindepth.com/Articles/General/Singleton.aspx">article</a>:</p>
  
  <blockquote>
    <p>The laziness of type initializers is only guaranteed by .NET when the type isn't marked with a special flag called beforefieldinit. Unfortunately, the C# compiler (as provided in the .NET 1.1 runtime, at least) marks all types which don't have a static constructor (i.e. a block which looks like a constructor but is marked static) as beforefieldinit.</p>
  </blockquote>
  
  <p>Is the static constructor not needed in the newest version of C#?</p>
  
  <p>The code above is the implementation of <code>SystemClock</code> in NodaTime project, by Jon Skeet.'</p>
  
  <p><strong>EDIT</strong>
  Jon Skeet code for reference (why I'm mentioning this beforefieldinit flag):</p>
  
  <pre><code>public sealed class Singleton
  {
      private static readonly Singleton instance = new Singleton();
  
      // Explicit static constructor to tell C# compiler
      // not to mark type as beforefieldinit
      static Singleton()
      {
      }
  
      private Singleton()
      {
      }
  
      public static Singleton Instance
      {
          get
          {
              return instance;
          }
      }
  }
  </code></pre>