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 the and operator in c#?
What is difference between yielding and sleeping?
Explain the differences between static, void and public in c#?
What is a console device?
How do you prevent a method from being overridden in c#?
What is the difference between dataset and datatable in c#?
what is collections in .net? why we use?
These questions were asked me in a technical interview: •If we deploy an application on multiple server (like database server, web server) then, each request should be redirected to proper server, then how you will handle it in your code? •How security pinholes will be handled in an application? •What things should be considered while writing a web application? •How will you do load/performance testing of web application? Which framework you will use for it? •How will you implement a cache for results which require a DB access? Please let me know how to write an web application considering all these points. I am not so much aware of architechural design of web application. Your guidelines will be helpful.
What is base class in c#?
what is the difference between a struct and a class in c#?
Explain the Different types of configuration files in .net?
What is the difference between namespace and class in c#?
Illustrate the process of code compilation in c#?
Can a class have multiple constructors c#?
What is cookies in c# asp net?