What are delegates and why are they required? - C#.NET

What are delegates and why are they required?

The delegates in .NET are like the pointers to the functions in C/C++. The difference is that these are type safe unlike the once in C/C++.

There are situations where in a programmer or an application needs to perform an action on a particular event. Eg: Some user action like click, text change, etc. So when these actions are performed by the user, the delegates invoke the respective functions.

Delegates are like type safe function pointers. We need delegates as they can be used to write much more generic functions which are type safe also.

It encapsulates the memory address of a function in the code. Events are created using delegates in .Net. When an event is published/thrown, the framework examines the delegate behind the event and then calls the function that is referred to by the delegate.
How to implement Delegates in C#.NET
Explain how to implement Delegates in C#.NET - Here is an implementation of a very simple delegate that accepts no parameters...
C#.NET - CLR Triggers
A CLR trigger could be a Date Definition or Date Manipulation Language trigger or could be an AFTER or INSTEAD OF trigger...
C#.NET - Steps for creating CLR Trigger
Steps for creating CLR Trigger - Follow these steps to create a CLR trigger of DML (after) type to perform an insert action...
Post your comment