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 is the difference between selection and projection?

538


What is razor view in c#?

521


What are the types of comments in c#?

644


What is code verification?

615


Why attributes are used in c#?

555






What language is c# similar to?

571


How do I do a case-insensitive string comparison?

597


What is master page in asp net c#?

564


Can an exception be thrown from a catch block?

649


What is eager loading in c#?

537


What is data adapter in c#?

547


Does c# support multiple inheritance (mi)?

612


Why we need get set property in c#?

630


What is the difference between Java and .NET garbage collectors?

594


How does insertion sort work?

600