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 routing in c#?

455


User's session is explicitly killed by which method ?

499


Explain About ADO and its objects

566


How does c# achieve polymorphism?

466


Why is aws serverless?

497






What do you mean by winforms in c#?

502


What is the difference between protected and internal in c#?

458


What is a nullreferenceexception?

551


Why is .net so popular?

522


Why do we use anonymous method in c#?

495


What is jagged array?

537


What is part of a method signature in c#?

461


What is a byte in c#?

548


How more than one version of an assembly can keep in same place?

510


What is the default value of guid in c#?

467