title: Create and run dictionary of actions
body: <p>I'm trying to create a dictionary of actions and then run them in a loop. <a href="https://stackoverflow.com/questions/14264317/how-to-call-an-action-stored-in-dictionary">This</a> question helped, but I still get a compile error when adding the action to the dictionary:- <code>No overload for 'Action' matches delegate 'Action'.</code></p>
  
  <p>Thanks for any help.</p>
  
  <pre><code>Dictionary&lt;string, Action&gt; dActions = new Dictionary&lt;string, Action&gt;();
              // do the actions need to be created?
              Action&lt;string, int&gt; actSpot = new Action&lt;string, int&gt;(oBSM.Spot);
              Action&lt;string, int&gt; actDelta = new Action&lt;string, int&gt;(oBSM.Delta);
              dActions["Spot"] = new Action(actSpot);
              dActions["Delta"] = new Action(actDelta);
  
              // or add action to dictionary?
              dActions.Add("Spot", oBSM.Spot(string BookOrComp, int DP);
              dActions.Add("Delta", oBSM.Delta(string BookOrComp, int DP);
  
              foreach (var BookOrComp in ListBookOrComp)
              {
                  foreach (string Key in dActions.Keys)
                  {
                      for (int DP = 1; DP &lt;= 21; DP++)
                      {
                          dActions[Key]();
                      }
                  }
              }
  </code></pre>
  
  <p><strong>Update</strong>:
  I still get a couple of compile errors as show in the code</p>
  
  <pre><code>Dictionary&lt;string, Action&gt; dActions = new Dictionary&lt;string, Action&gt;();
              // create actions
              Action&lt;string, int&gt; actSpot = new Action&lt;string, int&gt;(oBSM.Spot);  
              Action&lt;string, int&gt; actDelta = new Action&lt;string, int&gt;(oBSM.Delta);  
              dActions["Spot"] = new Action(actSpot); // no overload for Action matches delegate Action
              dActions["Delta"] = new Action(actDelta); // ditto
  
  
              foreach (var BookOrComp in ListBookOrComp)
              {
                  foreach (string Key in dActions.Keys)
                  {
                      for (int DP = 1; DP &lt;= 21; DP++)
                      {
                          dActions[Key](BookOrComp,DP);  // delegate Action  does not take 2 arguments
                      }
                  }
              }
  </code></pre>