Lamda expression - Definition,Features - LINQ

Q.  What is lamda expression?

1. Anonymous function
2. Can  be used to create delegates
3. Named function
4. None

- Published on 31 Aug 15

a. 1, 2
b. 1, 2, 3
c. 1, 3
d. 4

ANSWER: 1, 2
 
A lambda expression is an anonymous function that can be used to create delegates. There are two types of lambda expression, Expression Lambda and Statement Lambdas.

Example:
delegateint del(int i);
static void Main(string[ ] args)
{
delmyDelegate = x => x * x * x;
int j = myDelegate(4);
}
In the above given example x is the parameter that is acted on by the expression x * x * x. So the value of x will be cube of x.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)