Can anybody explain What is delegates concept in C-Sharp Language? How to use? Why should we use?
Answers
Answered by
1
Introduction:
Here I will explain what is delegates in c#.net with example. Basically delegates in c# are type safe objects which are used to hold reference of one or more methods in c#.net. Delegates concept will match with pointer concept of c language.
Description:
In previous posts I explained OOPS examples in c#, polymorphism in c#, Difference b/w datareader, dataset and dataadapter in c#, Difference b/w appsettings and connection strings in asp.net, Difference b/w executereader, executenonquery and executescalar in c# and many articles relating to interview questions in c#, asp.net, sql server, javascript, jquery. Now I will explain delegates in c#.net with example.
Whenever we want to create delegate methods we need to declare with delegate keyword and delegate methods signature should match exactly with the methods which we are going to hold like same return types and same parameters otherwise delegate functionality won’t work if signature not match with methods.
Here I will explain what is delegates in c#.net with example. Basically delegates in c# are type safe objects which are used to hold reference of one or more methods in c#.net. Delegates concept will match with pointer concept of c language.
Description:
In previous posts I explained OOPS examples in c#, polymorphism in c#, Difference b/w datareader, dataset and dataadapter in c#, Difference b/w appsettings and connection strings in asp.net, Difference b/w executereader, executenonquery and executescalar in c# and many articles relating to interview questions in c#, asp.net, sql server, javascript, jquery. Now I will explain delegates in c#.net with example.
Whenever we want to create delegate methods we need to declare with delegate keyword and delegate methods signature should match exactly with the methods which we are going to hold like same return types and same parameters otherwise delegate functionality won’t work if signature not match with methods.
Adeel143:
if you dont mind could you please post the previous articles in oops which you were talking about and differences also..Thanks buddy.
Similar questions