Untitled

 avatar
unknown
plain_text
a year ago
442 B
5
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