title: Dictionary of events (each value can hold several methods)
body: <p>I've tried looking for an answer here in previous posts, but I didn't find one.<br>
  I'm doing a MonoGame game, and I decided I want to have a event based keyboard handler.  </p>
  
  <p>So the KeyboardHandler class is a singleton class,
  And right now it has:<br>
  - delegate void KeyPressEventHandler()<br>
  - events of that delegate for the four arrow keys<br>
  - static instance of the class for singleton<br>
  - get method for that instance<br>
  - A while(true) thread method and a method that creates a thread that calls that method.</p>
  
  <p>The thread method is just a while(true) that checks if a keypress of any of the the four arrow keys have been pressed and activates their respective event if needed.</p>
  
  <p>I want to be able to create a dictionary of <code>&lt;Keys, (event or whatever)&gt;</code> so that I can for example:</p>
  
  <pre><code>void doSomething() { }
  KeyboardHandler.Get().SubscribeToEvent(Keys.A, doSomething)
  void SubscribeToEvent(Keys key, Action toSubscribe)
  {
      this.KeypressHandler[key] += new KeypressEventHandler(tobSubscribe)
  }
  </code></pre>
  
  <p>And a method that would handle firing these event handlers of course.</p>
  
  <p>But How do I declare such a dictionary?</p>
  
  <p>EDIT: eventually implemented here: <a href="https://github.com/gioragutt/training/blob/master/MonoGameFirst/MonoGameFirst/BaseGameClasses/KeyboardHandler.cs" rel="nofollow">https://github.com/gioragutt/training/blob/master/MonoGameFirst/MonoGameFirst/BaseGameClasses/KeyboardHandler.cs</a></p>