Delegates and Anonymous functions in C# 

Delegates and Anonymous functions are very much connected to each other. Below are the simple definitions for each-
Delegates :- Delegates are function’s pointer i.e Delegates can holds the references of one or more functions.

Anonymous Functions:- Anonymous functions help us reduce the overhead of creating the named functions where we want to assign some simple line of code to a delegate.

We should use the Anonymous functions when we want to use the delegate (with some line of code) in the same fuctions.

Performance is also much better while using Anonymous functions with delegates.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s