Created
January 7, 2018 22:33
-
-
Save luisdeol/5c6c37f3905fe7d59b4e8538f88cadf9 to your computer and use it in GitHub Desktop.
Multicasting delegate
This file contains hidden or 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
| using System; | |
| namespace create_implement_events_callbacks | |
| { | |
| class Program | |
| { | |
| public delegate void Calculate(int x, int y); | |
| public static void Add(int x, int y) | |
| { | |
| Console.WriteLine(x + y); | |
| } | |
| public static void Multiply(int x, int y) | |
| { | |
| Console.WriteLine(x * y); | |
| } | |
| static void Main(string[] args) | |
| { | |
| Calculate multiCastingCalc = Add; | |
| multiCastingCalc += Multiply; | |
| multiCastingCalc(3, 4); | |
| Console.ReadKey(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment