Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C# 3’s lambda etc..... Do I really need this

C# 3’s lambda etc..... Do I really need this

Scheduled Pinned Locked Moved The Lounge
csharplinqcomfunctional
37 Posts 27 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J J Dunlap

    No, you don't *have* to, but they're extremely useful and I'd highly recommend it. I wrote an article to help out with the learning process: Lambda Expressions and Expression Trees: An Introduction[^] </shameless-plug> Also check out extension methods because a lot of the places where lambdas are used involve extension methods as well. (Whoa, that's cool! :omg: I pasted the link to my article and it automatically put in the link with the article's title! Good work Chris and co! :cool: )

    S Offline
    S Offline
    Shelby Robertson
    wrote on last edited by
    #16

    J. Dunlap wrote:

    Also check out extension methods because a lot of the places where lambdas are used involve extension methods as well.

    Good call. My most frequent use of lambdas are with extension methods for collections to do things like Where, Select, Sorting, etc.

    Ennis Ray Lynch, Jr. wrote:

    Unpaid overtime is slavery.

    Trollslayer wrote:

    Meetings - where minutes are taken and hours are lost.

    B 1 Reply Last reply
    0
    • P Pete OHanlon

      Errm - they aren't just for C#, and no you don't. You could just continue coding with gotos and monolithic procedures if you really wanted to. After all, who needs these fancy, schmancy features? Productivity is for wimps after all.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      B Offline
      B Offline
      Brady Kelly
      wrote on last edited by
      #17

      And unprofessional coders.  Never forget the large proportion of progressive and educated development professionals that churn out unprofessional code when they fall prey to these Satanic and Lazy constructs that have only recently been accommodated in the most Utopian language and runtime that is C# 3.0 on .NET Framework 3.5.  OK, that felt a bit like little boy scouts probably felt when they held Nazi banners up high for visiting diplomats and politicians.

      1 Reply Last reply
      0
      • J Jorgen Sigvardsson

        Yes, unless you have something against expressive and easy to follow code...

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #18

        Oh, heathen!  What is wrong with redundantly declared (non-)anonymous methods, used in shelf-operations like "Distinct".  Oh the code. it haunts me so not having to rewrite an debug it, but I'm not a professional coder, so I must either get used to debugging boilerplate, or shape up and stop rewriting code with spelling and typing mistakes.  I mean, I had the logic correct all the time, but these little agents of the Dark One keep throwing magnetic spanners in my freaking production line for "Real Life Output".

        1 Reply Last reply
        0
        • S Shelby Robertson

          J. Dunlap wrote:

          Also check out extension methods because a lot of the places where lambdas are used involve extension methods as well.

          Good call. My most frequent use of lambdas are with extension methods for collections to do things like Where, Select, Sorting, etc.

          Ennis Ray Lynch, Jr. wrote:

          Unpaid overtime is slavery.

          Trollslayer wrote:

          Meetings - where minutes are taken and hours are lost.

          B Offline
          B Offline
          Brady Kelly
          wrote on last edited by
          #19

          This whole extension method, new-fangled thang is more dangerous than gay marriage!  Vote to stop it before it gets to your youth. :suss: Thatv was a lot easier to squeeze in that a programming post. :laugh:

          1 Reply Last reply
          0
          • P Pete OHanlon

            He should start off on learning to dance the salsa before moving onto the lambada.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #20

            tonight we will use the lambda, the forbidden construct !

            image processing toolkits | batch image processing

            1 Reply Last reply
            0
            • K keencomputer

              Do I really need to learn this C# 3’s lambda whatever...........

              Tapas Shome System Software Engineer Keen Computer Solutions 1408 Erin Street Winnipeg, Manitoba Canada R3E 2S8 http://www.keencomputer.com www.ias-research.com/blog

              C Offline
              C Offline
              Chris Austin
              wrote on last edited by
              #21

              Probably not...but I've been using lambdas in different languages for about a decade now and it is pretty darn handy at times. Right tool for the job and what not.

              And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell

              1 Reply Last reply
              0
              • K keencomputer

                Do I really need to learn this C# 3’s lambda whatever...........

                Tapas Shome System Software Engineer Keen Computer Solutions 1408 Erin Street Winnipeg, Manitoba Canada R3E 2S8 http://www.keencomputer.com www.ias-research.com/blog

                S Offline
                S Offline
                Super Lloyd
                wrote on last edited by
                #22

                God No! But if you ever learn it accidentally you will be surprised by how easy and useful it is and you will regret not having learn it before!

                A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                1 Reply Last reply
                0
                • D Dario Solera

                  Once you get them, they're totally, absolutely awesome. Besides that, it only really takes 10 minutes.

                  If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3

                  B Offline
                  B Offline
                  bryce
                  wrote on last edited by
                  #23

                  explain then to us :) Bryce

                  MCAD --- To paraphrase Fred Dagg - the views expressed in this post are bloody good ones. --
                  Publitor, making Pubmed easy. http://www.sohocode.com/publitor

                  Our kids books :The Snot Goblin, and Book 2 - the Snotgoblin and Fluff

                  1 Reply Last reply
                  0
                  • P Pete OHanlon

                    Errm - they aren't just for C#, and no you don't. You could just continue coding with gotos and monolithic procedures if you really wanted to. After all, who needs these fancy, schmancy features? Productivity is for wimps after all.

                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                    My blog | My articles | MoXAML PowerToys | Onyx

                    K Offline
                    K Offline
                    keozcigisoft
                    wrote on last edited by
                    #24

                    ROFL! Absolutely :laugh:

                    1 Reply Last reply
                    0
                    • K keencomputer

                      Do I really need to learn this C# 3’s lambda whatever...........

                      Tapas Shome System Software Engineer Keen Computer Solutions 1408 Erin Street Winnipeg, Manitoba Canada R3E 2S8 http://www.keencomputer.com www.ias-research.com/blog

                      K Offline
                      K Offline
                      keozcigisoft
                      wrote on last edited by
                      #25

                      It's C# 4.0 already and you are asking what has become an everyday tool :S

                      1 Reply Last reply
                      0
                      • K keencomputer

                        Do I really need to learn this C# 3’s lambda whatever...........

                        Tapas Shome System Software Engineer Keen Computer Solutions 1408 Erin Street Winnipeg, Manitoba Canada R3E 2S8 http://www.keencomputer.com www.ias-research.com/blog

                        M Offline
                        M Offline
                        msusur
                        wrote on last edited by
                        #26

                        Yeah you need to! As Dario said, it should have only 10 minutes to learn it. If you had start learning it instead of asking here you have already learnt it.

                        1 Reply Last reply
                        0
                        • P Pete OHanlon

                          Errm - they aren't just for C#, and no you don't. You could just continue coding with gotos and monolithic procedures if you really wanted to. After all, who needs these fancy, schmancy features? Productivity is for wimps after all.

                          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                          My blog | My articles | MoXAML PowerToys | Onyx

                          A Offline
                          A Offline
                          Adriaan Davel
                          wrote on last edited by
                          #27

                          Pete O'Hanlon wrote:

                          Productivity is for wimps after all.

                          Spoken like a true Klingon

                          ____________________________________________________________ Be brave little warrior, be VERY brave

                          1 Reply Last reply
                          0
                          • M MidwestLimey

                            Unless, of course, he never used anonymous methods either ....

                            10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011

                            T Offline
                            T Offline
                            thedavejay
                            wrote on last edited by
                            #28

                            Yes, Lambda is important to learn. From what I have seen, people are starting to move more towards functional programming. Its also important to learn to utilize the generic delegates Action<> and Func<>, anonymous methods using lambda expressions (all important parts to functional programming).

                            1 Reply Last reply
                            0
                            • K keencomputer

                              Do I really need to learn this C# 3’s lambda whatever...........

                              Tapas Shome System Software Engineer Keen Computer Solutions 1408 Erin Street Winnipeg, Manitoba Canada R3E 2S8 http://www.keencomputer.com www.ias-research.com/blog

                              S Offline
                              S Offline
                              ScottM1
                              wrote on last edited by
                              #29

                              keencomputer wrote:

                              Keen Computer Solutions

                              You don't seem that keen. ;P

                              1 Reply Last reply
                              0
                              • C Chris Meech

                                Absolutely. Become a good shepherd and learn all about lambs, ... Oh my bad. You said lambda. Sorry. :)

                                Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

                                G Offline
                                G Offline
                                Gary Wheeler
                                wrote on last edited by
                                #30

                                It puts the lotion on its skin or it gets the hose again...

                                Software Zen: delete this;

                                1 Reply Last reply
                                0
                                • J J Dunlap

                                  No, you don't *have* to, but they're extremely useful and I'd highly recommend it. I wrote an article to help out with the learning process: Lambda Expressions and Expression Trees: An Introduction[^] </shameless-plug> Also check out extension methods because a lot of the places where lambdas are used involve extension methods as well. (Whoa, that's cool! :omg: I pasted the link to my article and it automatically put in the link with the article's title! Good work Chris and co! :cool: )

                                  D Offline
                                  D Offline
                                  duwkes
                                  wrote on last edited by
                                  #31

                                  First off, great article. Secondly, I've been avoiding lambda expressions because my boss hates unnecessary complexity. Funny thing is that we've been adding complexity by using delegates! With such a concise article, I think it will be much easier to get him to realize that they are a good thing. Thanks again!

                                  J 1 Reply Last reply
                                  0
                                  • P Pete OHanlon

                                    Errm - they aren't just for C#, and no you don't. You could just continue coding with gotos and monolithic procedures if you really wanted to. After all, who needs these fancy, schmancy features? Productivity is for wimps after all.

                                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                    My blog | My articles | MoXAML PowerToys | Onyx

                                    V Offline
                                    V Offline
                                    vettbird
                                    wrote on last edited by
                                    #32

                                    What's wrong with using the query language instead of Lambda?

                                    T 1 Reply Last reply
                                    0
                                    • K keencomputer

                                      Do I really need to learn this C# 3’s lambda whatever...........

                                      Tapas Shome System Software Engineer Keen Computer Solutions 1408 Erin Street Winnipeg, Manitoba Canada R3E 2S8 http://www.keencomputer.com www.ias-research.com/blog

                                      R Offline
                                      R Offline
                                      rscjeff
                                      wrote on last edited by
                                      #33

                                      Yes - you'll find that they make your life easier when trying to implement predicate methods. In addition, if you ever inherit code that makes use of lambda expressions, wouldn't you want to at least have some semblance of familiarity? The better question is, do you *have* to know this? Answer is no. Lambda expressions are there to help, not replace.

                                      1 Reply Last reply
                                      0
                                      • D duwkes

                                        First off, great article. Secondly, I've been avoiding lambda expressions because my boss hates unnecessary complexity. Funny thing is that we've been adding complexity by using delegates! With such a concise article, I think it will be much easier to get him to realize that they are a good thing. Thanks again!

                                        J Offline
                                        J Offline
                                        J Dunlap
                                        wrote on last edited by
                                        #34

                                        Awesome - glad I could help!

                                        1 Reply Last reply
                                        0
                                        • S Shelby Robertson

                                          Yes. And I must add that after you get used to using them there are some excellent everyday uses.

                                          Ennis Ray Lynch, Jr. wrote:

                                          Unpaid overtime is slavery.

                                          Trollslayer wrote:

                                          Meetings - where minutes are taken and hours are lost.

                                          T Offline
                                          T Offline
                                          tec goblin
                                          wrote on last edited by
                                          #35

                                          They are short, efficient, clear, and named after a Greek letter :P. What else do you need to love them? :-D

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups