Page 19 - CSharp/C#
P. 19

Creating cancelable event                                                                        324

            Event Properties                                                                                 325

        Chapter 54: Exception Handling                                                                      327

          Examples                                                                                           327


            Basic Exception Handling                                                                         327
            Handling specific exception types                                                                327

            Using the exception object                                                                       327

            Finally block                                                                                    329

            Implementing IErrorHandler for WCF Services                                                      330

            Creating Custom Exceptions                                                                       333

        Creating Custom Exception Class                                                                     333

        re-throwing                                                                                         333

        serialization                                                                                       334

        Using the ParserException                                                                           334


        Security Concerns                                                                                   335

        Conclusion                                                                                          335

          Exception Anti-patterns                                                                            336

        Swallowing Exceptions                                                                               336


        Baseball Exception Handling                                                                         336

        catch (Exception)                                                                                   337

          Aggregate exceptions / multiple exceptions from one method                                         338

          Nesting of Exceptions & try catch blocks.                                                          339

          Best Practices                                                                                     340

          Cheatsheet                                                                                         340

          DO NOT manage business logic with exceptions.                                                      340

          DO NOT re-throw Exceptions                                                                         341

          DO NOT absorb exceptions with no logging                                                           341

          Do not catch exceptions that you cannot handle                                                     342


            Unhandled and Thread Exception                                                                   342
            Throwing an exception                                                                            343

        Chapter 55: Expression Trees                                                                        344
   14   15   16   17   18   19   20   21   22   23   24