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 virtual in c#?

470


What are the different states of a thread?

521


Where are value types stored in c#?

509


While debugging a C# application can you change the value of a variable?

526


What are the return types in c#?

481






What is an interface class in c#?

530


What is console readkey in vb net?

631


Define the term immutable ?

607


What is the difference between continue and break statement?

507


What is delegate in c#?

533


Does c# support parameterized properties?

507


Explain what are the steps for creating clr trigger?

456


What type is string in c#?

471


Is std :: string null terminated?

478


What is difference between gridview and form view?

512