Action
// Declare an Action variable
Action<string> action = (s) => Console.WriteLine(s);
// Invoke the Action
action("Hello World!");public void Method(Action<int> action)
{
// Invoke the action
action(10);
}
// Call the method
Method((x) => Console.WriteLine(x * x));Action action1 = () => Console.WriteLine("Action 1");
Action action2 = () => Console.WriteLine("Action 2");
// Create an action chain
Action actionChain = action1.AndThen(action2);
// Invoke the action chain
actionChain();