This is the .NET interview questions which you come across many a times. So following is the answer to it with explanation.
Creating a delegate is four step process:-
• Declare a delegate.
• Create an object reference.
• Point the reference to the method.
• Invoke the method via the delegate.
Below is the code snippet for the same.
// Declare a delegate public delegate int PointToAdd(int i, int y); // Create a reference pointer PointToAdd objpointer = null; // Point to the method objpointer = Add; // Invoke the function/method objpointer.Invoke(10,20);
See the following video on different types of collection in .NET and C#: -
Dotnet interview questions and answers for preparation of real time interviews.
Get more from author’s blogs for Most asked Dotnet interview questions
write a comment