Multicaste delecate in c#

Multicaste delecate in c#

Here our code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace multicastedelegate
{
    class Program
    {

        public delegate void GetResult(int x, int y);

        public void Sum(int x, int y)
        {
            int Z = x + y;
            Console.Write(Z +""+ Environment.NewLine) ;
           
        }

        public void Sub(int x, int y)
        {
            int Z = x - y;
            Console.Write(Z);
        }
        static void Main(string[] args)
        {
            Program p = new Program();
            GetResult d = p.Sum;
             d(1,2);
            d = p.Sub;
            d(8, 6);

            Console.Read();

        }
    }
}


Output
3
2

Share this

Previous
Next Post »

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer