Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created January 7, 2018 22:33
Show Gist options
  • Save luisdeol/5c6c37f3905fe7d59b4e8538f88cadf9 to your computer and use it in GitHub Desktop.
Save luisdeol/5c6c37f3905fe7d59b4e8538f88cadf9 to your computer and use it in GitHub Desktop.
Multicasting delegate
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