© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
Quick Links
Easy Studies

  HomeSource Code DotNet ► C# ▼

Single Delegate

Delegate is type which holds the method(s) reference in an object.
it is also reffered as a type safe function pointers.


using System;
using System.Collections.Generic;
using System.Text;

namespace delegates
    public delegate void TestDelegate(string message); //Declare the delegate
    class Test
        public static void Display(string message)
            Console.WriteLine("The string entered is : " + message);
        static void Main()
            TestDelegate t = new TestDelegate(Display); //Instantiate the delegate
            Console.WriteLine("Please enter a string");
            string message = Console.ReadLine();
            t(message); //Invoke the delegate



SLogix Student Projects