using System;
public class Operation
{
public static void Add(int a, int b)
{
Console.WriteLine("\nAddition={0}",a + b);
}
public static void Multiple(int a, int b)
{
Console.WriteLine("\nMultiply={0}", a * b);
}
}
public class exam
{
delegate void DelOp(int x, int y);
public static void Main()
{
// Delegate instantiation
DelOp[] obj = {new DelOp(Operation.Add),new DelOp(Operation.Multiple)};
for (int i = 0; i < obj.Length; i++)
{
obj[i](2,5);
obj[i](8,5);
obj[i](4,6);
}
}
} C#
Delegaes concept using C# Language.

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
