Anonymous Methods were introduced in c# 2.0 as a way of creating delegate instances without
having to write a separate method . They can capture local variables within the enclosing method making them a form of closure.
what is Anonymous method ?
Anonymous method is an inline un-named method in the code.
1.it is created using the delegate keyword and
doesn't require name and return type and hence we can consider an anonymous method has only body without name and return type.
syntax :
==========
delegate ( [ argInfo ] )
{
// statements
}
What is lambda expression ?
A lambda expression is an anonymous function that we can use to create a delegate or expression tree types.
By using Lambda Expressions you can create local functions that can be passed as arguments or returned as the value of function calls.
Syntax :
==========
(input parameters) => expression;