Answer Posted / m.shanmuga sundaram
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public delegate int execute(int a, int
b); //declare a delegate method
static void Main(string[] args)
{
Program p = new Program();
execute ex = new execute(p.add);
Console.WriteLine(ex(2,3)); //add method is
executed
ex = new execute(p.subtract);
Console.WriteLine(ex(2, 3)); //subtract method
is executed
}
public int add(int a, int b)
{
return (a + b);
}
public int subtract(int a, int b)
{
return (a - b);
}
}
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is ilasm.exe used for?
What is a multicast delegate in c#?
What is extension method in c# and how to use them?
What is the default boolean value in c#?
What is console programming language?
Explain about Threading Types.
What do you understand by an Implicit Variable?
What is int32?
What is Co- and Contra-Variance in C#?
What is better C# or VB.NET?
What is using directive in c#?
What is type safe in c#?
Why do I get a security exception when I try to run my c# app?
What is public, private, protected, internal and internal protected?
Describe ways of cleaning up objects in c#.