Untitled
unknown
plain_text
2 years ago
442 B
6
Indexable
using System;
class Program
{
delegate void MyDelegate(int x);
static void Main()
{
MyDelegate myDelegate = DisplayNumber;
myDelegate(5);
myDelegate += DoubleNumber;
myDelegate(3);
}
static void DisplayNumber(int x)
{
Console.WriteLine($"The number is: {x}");
}
static void DoubleNumber(int x)
{
Console.WriteLine($"Double the number: {x * 2}");
}
}Editor is loading...
Leave a Comment