CodeSmith Community
Your Code. Your Way. Faster!

Lambda Expressions

Latest post 10-10-2008 9:14 AM by blake05. 3 replies.
  • 10-09-2008 11:05 PM

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Lambda Expressions

    I was messing around with Lambda expressions tonight(yea, I know, I was bored).  Here are a couple example uses with Nettiers (one using Find, another Filter).  Nettiers excepts delegates on several methods, so you can use the Lambda expressions in its place.

    It's a little shorter than putting delegate(Customers x) { return x.Name == "Munster"; }

    jeff

       1: TList<Customers> custList = DataRepository.CustomersProvider.GetAll();
       2:  
       3: Customers findCust = custList.Find(x => x.City == "Münster"); 
       4:  
       5: custList.ApplyFilter(x => x.City == "Münster");

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
  • 10-09-2008 11:06 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Re: Lambda Expressions

    Code formatting just SUCKS in this text editor!

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 10-10-2008 7:49 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 254
    • Points 6,460

    Re: Lambda Expressions

    I like Lambda expressions... make me write less code, but at the same time, makes me think a lot more... );

    I think it's hard to visualize this stuff...

    • Post Points: 35
  • 10-10-2008 9:14 AM In reply to

    • blake05
    • Top 10 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 565
    • Points 10,500

    Re: Lambda Expressions

    LOL, I agree, but if you work with them for long enough they start to make sense a lot quicker Smile

    -Blake Niemyjski

    Blake Niemyjski

    CodeSmith Tools, LLC. Software Development Engineer

    Blog: http://windowscoding.com/blogs/blake/

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
Page 1 of 1 (4 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems