using System; namespace practice { public delegate int MathOperation(int x, int y); public class DelegateExample { public static int Add(int x, int y) { return x + y; } public static void Main() { MathOperation d = Add; int res = d(2, 3); Console.WriteLine("Result: "+res); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter