/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using System; namespace DelegateTest { public delegate void TestDelegate(string message); class Program { public static void Display(string message) { Console.WriteLine(""); Console.WriteLine("The string entered is : " + message); } static void Main(string[] args) { //-- Instantiate the delegate //-- Input some text Console.WriteLine("Please enter a string:"); string message = Console.ReadLine(); //-- Invoke the delegate t(message); Console.ReadLine(); } } }