Page 32 - CSharp/C#
P. 32

Passing a Lambda Expression as a Parameter to a Method                                           563

            Lambda Expressions as Shorthand for Delegate Initialization                                      563

            Lambdas for both `Func` and `Action`                                                             563

            Lambda Expressions with Multiple Parameters or No Parameters                                     564

            Put Multiple Statements in a Statement Lambda                                                    564

            Lambdas can be emitted both as `Func` and `Expression`                                           564

            Lambda Expression as an Event Handler                                                            565

        Chapter 91: Lambda Expressions                                                                      567

          Remarks                                                                                            567

          Closures                                                                                           567

          Examples                                                                                           567

            Basic lambda expressions                                                                         567

            Basic lambda expressions with LINQ                                                               568

            Using lambda syntax to create a closure                                                          568

            Lambda syntax with statement block body                                                          569

            Lambda expressions with System.Linq.Expressions                                                  569
        Chapter 92: LINQ Queries                                                                            570


          Introduction                                                                                       570

          Syntax                                                                                             570

          Remarks                                                                                            572

          Examples                                                                                           572

            Where                                                                                            572

          Method syntax                                                                                      572

          Query syntax                                                                                       573

            Select - Transforming elements                                                                   573

            Chaining methods                                                                                 573
            Range and Repeat                                                                                 574


          Range                                                                                              574
          Repeat                                                                                             575


            Skip and Take                                                                                    575
            First, FirstOrDefault, Last, LastOrDefault, Single, and SingleOrDefault                          576

        First()                                                                                             576
   27   28   29   30   31   32   33   34   35   36   37