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

Explain what are the steps for creating clr trigger?

465


Why we use get set in c#?

494


What is icomparable in c#?

518


what is object-oriented programming (oop) language?

481


Wcf and what is difference between wcf and web services?

486






How do I create a new form in c#?

482


Which is the best language for desktop application?

468


Why we use delegates in c#?

498


Name the method of servicebase class?

535


What is a console?

495


What is gac? How to put assembly in gac?

550


How do I create a multi language, multi file assembly?

620


Why do we need constructor in c#?

492


What is the implicit name of the parameter that gets passed into the set method/property of a class?

495


What are the properties of string?

489