SIGN UP MEMBER LOGIN:    
ARTICLE

Lambda Expressions in C# 3.0

Posted by Kalyan Bandarupalli Articles | Visual C# October 15, 2008
In this artivle I will explain where to use the Anonymous methods first then we see the example on lambda expressions.
Reader Level:

Lambda expressions is one of the features introduced in the C# 3.0. Lambda expressions help you to ease the burden of writing verbose Anonymous Methods.

Anonymous Methods


Anonymous Methods is the feature in C# 2.0. The idea behind writing the anonymous methods is to write methods inline to the code without declaring a formal named method. Normally they used for small methods that don't require any reuse.

Example :




You can declare an anonymous method as follows :




Advantage : It saves some typing and puts the method closer to where it is being used which helps with maintenance.

Lambda Expressions

Lambda Expressions makes the thing even more easier by allowing you to write avoid anonymous method and statement block.



We can also effectively use the Lambda Expressions with LINQ and I will explain the feature in forth coming articles.

 

Login to add your contents and source code to this article
share this article :
post comment
 

Hi Kalyan Really you had written a very good article. Your way is very simple to explore your knowledge about lambda expression. I had also written a small blog on lambda expression that how to use lambda expression with use defined datatypes. I used lambda expression for finding records. http://dabbu-csharphelp.blogspot.in/2012/03/lambda-expression.html I hope this blog is also useful to those users who wants to know about lambda expressio that how to find records from list using lambda expression. thanks to sharing this useful article.

Posted by Awadhendra Tiwari Mar 26, 2012

Hi

For your information i have used C# 3.0 manual for reference. I think this post helps the people in understanding the concept.

 

Posted by Kalyan Bandarupalli Dec 02, 2008

I just want to say that this guy has copuied this article from the following url: http://www.davidhayden.com/blog/dave/archive/2006/11/30/LambdaExpressionsExtensionMethodsLINQ.aspx

Posted by GURJEET SINGH Dec 02, 2008
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Team Foundation Server Hosting
Become a Sponsor