What is a lambda expression, Computer Engineering

 A Lambda expression is not anything but an Anonymous Function, can have expressions and statements. Lambda expressions can be used mostly to make delegates or expression tree types. Lambda expression uses lambda operator => and read as 'goes to' operator.


Left side of this operator specifies the input parameters and haves the expression or statement block at the right side.


Example: myExp = myExp/10;


Now, let see how we can assign the above to a delegate and make an expression tree:


delegate int myDel(int intMyNum);

static void Main(string[] args)


//assign lambda expression to a delegate:

myDel myDelegate = myExp => myExp / 10;

int intRes = myDelegate(110);

Console.WriteLine("Output {0}", intRes);



//Create an expression tree type

//This needs System.Linq.Expressions

Expression myExpDel = myExp => myExp /10;




The => operator has the similar precedence as assignment (=) and is right-associative.


Lambdas are used in method-based LINQ queries as arguments to standard query operator methods such as Where.



Posted Date: 4/3/2013 2:04:37 AM | Location : United States

Related Discussions:- What is a lambda expression, Assignment Help, Ask Question on What is a lambda expression, Get Answer, Expert's Help, What is a lambda expression Discussions

Write discussion on What is a lambda expression
Your posts are moderated
Related Questions
Question: (a) Primary and secondary memory differs in their way they access data: (i) Mention the four generic access methods usually present in a computer system. (ii) E

ISDN handles data pertaining to? ISDN handles data pertaining to all digital services.

Define Edge Triggered D flip-flop? D latch has only two inputs C(control) and D(data). The operation of a D flip-flop is a lot simpler and it has only one input addition to the

Write a recursive algorithm to count the number of right children in a binary search tree. Write the method levelCount whose header is given below. Method levelCount returns

write a program to find the area under the curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits of a and b

a) Give eight properties for each of static RAM (SRAM) and DRAM (dynamic RAM) and provide the low-level structure of each type of memory. b) Assume a system with 16 Megabytes o

What is memory controller? A memory controller is a circuit which is interposed among the processor and the dynamic memory. It is used for performing multiplexing of address bi

Explain the advantages of computer Computer is one of the main components of an Information Technology network and getting increasing popularity. Nowadays, computer technology

Use the Rational Administrator to: * Make and manage projects. * Make a project under configuration management. * Make a project outside of configuration management.