Page 21 - CSharp/C#
P. 21

Extension methods dispatch based on static type                                                    358
          Extension methods aren't supported by dynamic code.                                                360


          Extension methods as strongly typed wrappers                                                       361

          Extension methods for chaining                                                                     361

          Extension methods in combination with interfaces                                                   362

          IList Extension Method Example: Comparing 2 Lists                                                  362

          Extension methods with Enumeration                                                                 363

          Extensions and interfaces together enable DRY code and mixin-like functionality                    365

          Extension methods for handling special cases                                                       365

          Using Extension methods with Static methods and Callbacks                                          366

          Extension methods on Interfaces                                                                    368

          Using Extension methods to create beautiful mapper classes                                         368

          Using Extension methods to build new collection types (e.g. DictList)                              369

        Chapter 57: File and Stream I/O                                                                     371

          Introduction                                                                                       371


          Syntax                                                                                             371

          Parameters                                                                                         371

          Remarks                                                                                            371

          Examples                                                                                           372

            Reading from a file using the System.IO.File class                                               372

            Writing lines to a file using the System.IO.StreamWriter class                                   372

            Writing to a file using the System.IO.File class                                                 372
            Lazily reading a file line-by-line via an IEnumerable                                            373

            Create File                                                                                      373

            Copy File                                                                                        374

            Move File                                                                                        374

            Delete File                                                                                      375

            Files and Directories                                                                            375

            Async write text to a file using StreamWriter                                                    375

        Chapter 58: FileSystemWatcher                                                                       376

          Syntax                                                                                             376

          Parameters                                                                                         376
   16   17   18   19   20   21   22   23   24   25   26