tjindapitak
9/27/2017 - 5:15 PM

delegateHell1.cs

using System;

public class Program {
    public delegate string CustomDelegate(int n);
    public CustomDelegate customDelegate;

    public static void Main() {
        Program p = new Program();
        p.customDelegate = (n) => { Console.WriteLine("HELLO " + n); return "NOTHING"; };
        p.customDelegate += (n) => { Console.WriteLine(", PEACE OUT " + n); return "HERE"; };

        var output = p.customDelegate(2); 

        Console.WriteLine(output);
        /*
            HELLO 2
            , PEACE OUT 2
            HERE
        */
    }
}