what is lamda expression?

Answer Posted / wasimhajwane

lambda expression :
Lambda expression is introduce in c# version 3.0.Its a method without having declaration,
A lambda expression is a anonymous function mostly used to create delegate in LINQ.
 Syntax:

parameter => expression or statement block.

simple program to understand lambda expreesion


class A
{
// we have to declare delegate here

public delegate int B(int a);

static void main()
{
B b=a=>a*a;
int res=b(5);
Console.WriteLine("result = ",res);
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are primitive types in c#?

710


Why array is faster than arraylist in c#?

666


What is a strong name in c#?

993


Why would you use a class property in c#?

670


What is array and arraylist?

731


What is the advantage of generics in c#?

674


What is difference between interface and abstraction?

661


What do you mean by saying a "class is a reference type"?

682


Which is faster hashtable or dictionary?

673


What is unsigned int?

681


Is c# strongly typed?

624


Are c and c# the same thing?

654


What is the difference between Singleton design pattern and Factory design pattern?

721


What is exe in c#?

660


Can constructor have return type c#?

802