title: How to create a list of methods?
body: <p>How can I execute a method one by one in the order they were added to the <code>List&lt;Action&gt;</code>?</p>
  <pre><code>List&lt;Action&gt; actions = new List&lt;Action&gt;();
  
          List&lt;int&gt; listaInt = new List&lt;int&gt;();
  
          for (int i = 0; i &lt; 5; i++) {
              listaInt.Add(i);
              var entries = entries1.Select(d =&gt; string.Format(&quot;{0}&quot;, string.Join(&quot;,&quot;, d)));
              actions.Add(new Action(() =&gt; { 
                  Console.WriteLine(&quot;counterList: &quot; + string.Join(&quot;,&quot;, entries ));
              }));
          }
  </code></pre>
  <p>I want to execute every function, but with the list of integers(<code>List&lt;int&gt;</code>)</p>
  <pre><code>        foreach (Action action in actions) {
              action();
          }
  </code></pre>
  <p>Result:</p>
  <pre>
  listaInt: 0,1,2,3,4
  listaInt: 0,1,2,3,4
  listaInt: 0,1,2,3,4
  listaInt: 0,1,2,3,4
  listaInt: 0,1,2,3,4
  </pre>
  <p>Expected result:</p>
  <pre>
  listaInt: 0
  listaInt: 0,1
  listaInt: 0,1,2
  listaInt: 0,1,2,3
  listaInt: 0,1,2,3,4
  </pre>