title: why Static constructors not called first and i got exception when use declared variable?
body: <p>From MSDN</p>
  <blockquote>
  <p>A static constructor is used to initialize any static data, or to perform a particular action that needs to be performed once only. It is called automatically before the first instance is created or any static members are referenced</p>
  </blockquote>
  <p><a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-constructors" rel="nofollow noreferrer">MSDN Link</a></p>
  <p>Now came to my problem:</p>
  <pre><code>public static class DateFormat
  {
      private static List&lt;string&gt; DateFormats = new List&lt;string&gt;();
  
      public static string DateSeparator  { get; set; } = &quot;/&quot;;
  
      public static string Current { get; set; } = DateFormats[1]; // error here
  
      static DateFormat()
      {
          DateFormats.Add(&quot;yyyy{0}MM{0}dd HH{1}mm{1}ss&quot;);
          DateFormats.Add(&quot;yyyy{0}MM{0}dd hh{1}mm{1}ss&quot;);
      }
  }
  </code></pre>
  <p>As you see above when calling <code>DateFormats[1]</code> error</p>
  <blockquote>
  <p>&quot;The type initializer for 'DateFormat' threw an exception.&quot;</p>
  </blockquote>
  <p>Is constructor should calling static constructor first?  so that dictionary will filled then any call to variable which use it will be ok.</p>