Created
December 13, 2017 18:21
-
-
Save fmork/4a4ddf687fa8398d19ddb2df96f0b434 to your computer and use it in GitHub Desktop.
Delegate.Combine with Action<string>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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