title: A field initializer cannot reference the non-static field, method, or property
body: <p>I have the following code into a Form:</p>
  
  <pre><code>using System;
  using System.Diagnostics;
  using System.Drawing;
  using System.IO;
  using System.Media;
  using System.Reflection;
  using System.Runtime.InteropServices;
  using System.Windows.Forms;
  
  namespace ScreenShots
  {
      public partial class ScreenShotConfigurationForm : Form
      {
  
          // ----- some other stuff (code, methods, etc...) is placed in here -----
  
          private const int WH_KEYBOARD_LL = 13;
          private const int WM_KEYDOWN = 0x0100;
          private LowLevelKeyboardProc _proc = HookCallback; // &lt;&lt;&lt;&lt; This is the row that is causing the error
          private IntPtr _hookID = IntPtr.Zero;
  
          private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
          {
              if (nCode &gt;= 0 &amp;&amp; wParam == (IntPtr)WM_KEYDOWN)
              {
                  int vkCode = Marshal.ReadInt32(lParam);
                  if (vkCode == 44) // 44 is the key code of PrintScreen button
                  {
                      MakeScreenShot();
                  }
              }
  
              return CallNextHookEx(_hookID, nCode, wParam, lParam);
          }
  
          private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
  
          private IntPtr SetHook(LowLevelKeyboardProc proc)
          {
              using (Process curProcess = Process.GetCurrentProcess())
  
              using (ProcessModule curModule = curProcess.MainModule)
              {
                  return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
              }
          }
  
          [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
          private extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
  
          [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
          [return: MarshalAs(UnmanagedType.Bool)]
  
          private extern bool UnhookWindowsHookEx(IntPtr hhk);
  
          [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
          private extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
  
          [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
          private extern IntPtr GetModuleHandle(string lpModuleName);
      }
  }
  </code></pre>
  
  <p>That is giving me the following error on Microsoft C# 2008:</p>
  
  <p><strong>A field initializer cannot reference the non-static field, method, or property 'ScreenShots.ScreenShotConfigurationForm.HookCallback(int, System.IntPtr, System.IntPtr)'</strong></p>
  
  <ol>
  <li>What does it mean?</li>
  <li>How can I solve it?</li>
  </ol>
  
  <p>A screenshot of what I see:
  <a href="https://i.stack.imgur.com/O1eYP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O1eYP.png" alt="enter image description here"></a></p>