Last post May 23, 2014 05:38 PM by Tipone
May 23, 2014 04:09 AM|Nikita Deshmukh|LINK
What is the use of delegates? why can't we just call the method directly, instead of calling it via a delegate?
Thanks in advance
May 23, 2014 04:53 AM|Mikesdotnetting|LINK
why can't we just call the method directly, instead of calling it via a delegate?
Because the method doesn't exist. The method body is passed in as a parameter to the delegate instead.
See if this helps you understand more easily: http://www.mikesdotnetting.com/Article/91/Delegates-Anonymous-Methods-and-Lambda-Expressions-in-CSharp
May 23, 2014 05:38 PM|Tipone|LINK
It is your decision to use delegates or not, Just some times using delegates is easy and clean.
1.multiple method calls with one event trigger.
2.Reduce the Dependency on your code. (Class A is calling method in Class B directly, A depend on B), delegate will get rid this dependency