title: What does "a field initializer cannot reference non static fields" mean in C#?
body: <p>I don't understand this error in C#</p>
  
  <blockquote>
    <p>error CS0236: A field initializer cannot reference the non-static field, method, or property 'Prv.DB.getUserName(long)'</p>
  </blockquote>
  
  <p>For the following code</p>
  
  <pre><code>public class MyDictionary&lt;K, V&gt;
  {
      public delegate V NonExistentKey(K k);
      NonExistentKey nonExistentKey;
  
      public MyDictionary(NonExistentKey nonExistentKey_) { }
  }
  
  class DB
  {
      SQLiteConnection connection;
      SQLiteCommand command;
  
      MyDictionary&lt;long, string&gt; usernameDict = new MyDictionary&lt;long, string&gt;(getUserName);
  
      string getUserName(long userId) { }
  }
  </code></pre>