What is a delegate?

Answer Posted / venkat2050

delegate is a wrapper we can call any method at runtime to
call delegate by calling the keyword del
using system;
namespace sample prog
{
public delegate double(doublex,doubley);
class math
{
public double add(doublex,doubley);
{
returnx+y;
}
}
class sample
{
svm()
{
sample prog.Mathm=new sampleprog.math();
deld=new del(m.add);
c.w(d(48.97,27.29));
d=new del(m.sub);
c.w(d(29.29,7.92));
c.r
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between iqueryable and ienumerable?

557


What is difference between an Structure and Class?

651


What is the difference between malloc () and new?

574


Explain a MSIL ? Why is it appreciated by all developers?

672


What is the main method?

574






how to stored and retrive video in Sql server using asp.net c#......?

610


What is a base class in C#?

641


Define Abstract Class in C#

620


What is ilist c#?

596


What is web forms in c#?

581


Can you inherit from a static class in c#?

562


Is array ienumerable c#?

561


What is c sharp language?

603


Explain dataset.acceptchanges method in .net?

614


What is verbatim string?

588