title: Static Constructor and Extension methods
body: <p>Wondering if my static constructor fails and throws exception if the extension methods would still work?  The logger is intended to help detect issues in the extension methods.  If they won't still work I will have to try catch and make sure the constructor succeeds.  I would prefer to be able to have it throw exception as hopefully calling code can log the error.   (This is just example code similar to what I'm thinking about) </p>
  
  <pre><code>     public static class Extensions 
       {
  
          private static readonly log4net.ILog log;
          private const TIME_TO_CHECK;
  
          static Extensions() 
          {
              log = log4net.LogManager.GetLogger           (System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);  //could maybe throw exception
  
              TIME_TO_CHECK = readInFromFile();  //could maybe           throw                           exception            }           
  
          public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek) {
          int diff = dt.DayOfWeek - startOfWeek;
          if (diff &lt; 0) {
          diff += 7;
        }
        return dt.AddDays(-1 * diff).Date;
      }
    }
  </code></pre>
  
  <p>I did search around (Hopefully this isn't a repeat) and found that throwing exceptions from static constructor is not generally good.  In most cases I think the classes were ones that could be instantiated and weren't just all extension methods.     </p>