What is a lambda expression, Computer Engineering

Assignment Help:

 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);

Console.ReadLine();

 

//Create an expression tree type

//This needs System.Linq.Expressions

Expression myExpDel = myExp => myExp /10;

}

 

Note:

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.

 

 


Related Discussions:- What is a lambda expression

What are the advantages of using xml over html, What are the advantages of ...

What are the advantages of using XML over HTML?  The root cause of the problem lies in HTML (Hyper Text Mark-up Language), the defacto standard for web publication. The main pr

Assignment help on Operating System and JQuery, I need help on my assignmen...

I need help on my assignments that i need to submit in 10 days. There are total 3-4 assignments on two different subjects: 1) 2-3 assignments in Operating Systems and 2) 1-2 assign

Write a cgi program that prints date and time, Write a CGI program that pri...

Write a CGI program that prints date and time at which it was run. #!/bin/sh # # CGI script that prints the date and time at which it was run # # Output the documen

Duplicating processes, DUPLICATING PROCESSES : As we mentioned earlier dup...

DUPLICATING PROCESSES : As we mentioned earlier duplicating is a process whereby a master copy is prepared from which a large number of other copies are obtained with the help of

Explain biometric systems, Explain Biometric Systems Biometrics is the ...

Explain Biometric Systems Biometrics is the science of measuring physical properties of living beings. Biometric Authentication (1) Biometric authentication is the aut

Economic argument for good design, One way of demonstrating the importance ...

One way of demonstrating the importance of good ID is by showing tangible benefits that can be talked about in cash terms. Within a business, good ID can lead to benefits such as h

Programming for arithmetic and string operations, Advanced aspects of assem...

Advanced aspects of assembly language programming in this section. A number of these aspects give assembly an edge over high level language programming as far as efficiency is conc

Subtraction of 01000-01001 using 2's complement method, Subtraction of 0100...

Subtraction of 01000-01001 using 2's complement method. Ans. Firstly 1's complement of 01001 is 10110 and 2's complement is 10110+ 1 =10111. Thus   01000 =  01000 - 01001

State the web server security through ssl, Web server security through SSL ...

Web server security through SSL (Secure Socket Layer) As it is well known that the Intranets and internet are purely based on use of powerful web servers to deliver information

Determine flip-flops that are required for mod–16 counter, How many Flip-Fl...

How many Flip-Flops are required for mod-16 counter? Ans. 4 flip-flops is required for Mod-16 Counter. For Mod-m Counter, we require N flip-flops where N is selected to be the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd