How to Queue up Method Calls in C#

First you need to instantiate a List of type Action:

Next, we will add methods to the list. We do this through Lambda Expressions using a specific syntax: () => { TestFunc("data") };

With this technique local methods can be stored along with parameters for future execution. In the example below you can see two Console.WriteLine statements. But since the first method is housed in the expression it does not fire until executed later. However, the subsequent one will fire immediately and be listed first in the output tab of Visual Studio:

To fire off each method loop through and use function params to execute:

Chad

Read More