Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delegate.Combine with Action<string>
class Program
{
private static Action<string> stringAction;
static void Main(string[] args)
{
stringAction = new Action<string>(s => Console.WriteLine(s));
stringAction =(Action<string>) Delegate.Combine(stringAction, new Action<string>(s => Console.WriteLine(s)));
stringAction("Action called once"); // will be printed twice
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.