示例#1
0
        /// <summary>
        /// main method is calling.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            log4net.Config.BasicConfigurator.Configure();
            DelegeteDemo ob = new DelegeteDemo();

            ob.useDelegate();
            ob.useAnonymousDelegate();
            Rectangle re = new Rectangle();

            re.useRectDelegate();
            ob.useDelegateLambdaExp();
            Console.Read();
        }
示例#2
0
        /// <summary>
        /// invoke the method with the help of delegate
        /// </summary>
        public void useDelegate()
        {
            log4net.ILog log = log4net.LogManager.GetLogger(typeof(GenericDelegate));
            log.Info("Delegate is used for invoking the method");
            DelegeteDemo obj = new DelegeteDemo();
            addDelegete  ad  = new addDelegete(obj.addNums);

            ad.Invoke(125, 50);

            sayDelegete sd  = new sayDelegete(DelegeteDemo.sayHello);
            string      str = sd.Invoke("Atish chandra");

            Console.WriteLine(str);
        }