-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Anand_2004
Message 1 in Discussion

Hi Folks In today's session I am talking about Lambda Expression .   This is a 
very interesting feature of C# 3.0.This is  more  sophisticated  and  provide 
more functional programming benefit as compare to  anonymous methods ,anonymous 
method is one of the major enhancements in C# 2.0  its is nothing but a 
nameless method  used anywhere  a delegate type is expected .Lambda expression 
is the advance version of anonymous. Some basic feature of Lambda expression is 
it written as a parameter list, followed by the => symbol, for example    (int 
lambdaExp)  => lambdaExp +1;   This is not hard and fast rule that we must 
specify the type  in parameter list , if you specify the type then its called 
as explicit parameter list and  if you do not specify the type then itÂ’s called 
as implicit parameter list for example    lambdaExp  => lambdaExp +1;   Below 
code snippet demonstrate  how to use lambda expression , in this example I am 
trying to display the person name whose length is greater than 4 
using System;
using System.Collections.Generic;
using System.Text;
using System.Query;
using System.Xml.XLinq;
using System.Data.DLinq; namespace lamdaexpression
{
    class Program
    {
        static void Main(string[] args)
        {
            var friendList = new List<string>();
            friendList.Add("Anand");
           friendList.Add("Arun");
           friendList.Add("Sudha");
           friendList.Add("Anjana");
            friendList.Add("Sasi");
            friendList.Add("Pratap");
            friendList.Add("Jani");             var newList = 
friendList.FindAll( nameLen => nameLen.Length>4);             foreach (string 
name in newList)
         {
          Console.WriteLine(name);
         }
            Console.ReadLine();
        }
    }
}   
You can specify more then one expression in the parameter list some of the code 
benefits of Lambda expression are   1. Lambda expression allows explicitly and 
impiety parameter list  unlike anonymous method expects a explicitly type 
2. The implementation  ( body part) of lambda expression can be a piece of code 
or a  expression .
3. Lambda expressions with an expression body can be converted to expression 
trees.Expression tree is provide the facility to treat lambda expressions as 
data .This helps you to implement extension method  ( will discuss about it in 
my next post ) .
   Cheers Anand https://anandkumar2004.wordpress.com

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to