About delegates ?

Answer Posted / naren

1. Delegates holds reference to a method
2. Delegates are objects which points towards a function
which matches its signature
3. Delegates are reference type used to encapsulate method
with specific signature
4. Delegates are typesafe and secure

//declaring a delegate

delegate void SampleDelegate(string message)

//declaring delegate with same signature

static void SampleDelegateMethod(string message)
{
console.writeline(message);
}

//creating delegate method

SampleDelegate d1 = new SampleDelegateMethod();

//invoking method

d1(message);

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

if i wanna deploy my asp.net project to the production server and situation is that i m still not compiled my project i have as-is on my development side now on production server we dont have a visual studio now what kind of settings i need to be to do in webconfig /machine.config file to deploy my project and in iis too....

1592


How ViewstateMac works?

2355


What is the procedure to create the environment for asp.net? : asp.net mvc

503


Explain the asp.net session state modes.

604


What is new asp.net core?

563






Explain the asp.net mvc folder conventions? : asp.net mvc

499


Disable Mouse right click on web page in asp.net?

576


Is asp.net free?

544


What is break mode?

500


What kind of programming language is ASP.NET?

593


What is cas?

586


Demonstrate Render and PreRender?

590


What is boxing and unboxing in asp.net?

656


What is role-based security in asp.net?

515


Which is better session or viewstate?

500