Page 24 - CSharp/C#
P. 24

Type constraints (class and struct)                                                              403

            Type constraints (new-keyword)                                                                   404

            Type inference (classes)                                                                         404

            Reflecting on type parameters                                                                    405

            Explicit type parameters                                                                         405

            Using generic method with an interface as a constraint type.                                     406

            Covariance                                                                                       407

            Contravariance                                                                                   408
            Invariance                                                                                       409

            Variant interfaces                                                                               410

            Variant delegates                                                                                411

            Variant types as parameters and return values                                                    411

            Checking equality of generic values.                                                             412

            Generic type casting                                                                             412

            Configuration reader with generic type casting                                                   413

        Chapter 66: Getting Started: Json with C#                                                           415

          Introduction                                                                                       415

          Examples                                                                                           415

            Simple Json Example                                                                              415

            First things First: Library to work with Json                                                    415

            C# Implementation                                                                                415
            Serialization                                                                                    416

            Deserialization                                                                                  416

            Serialization & De-Serialization Common Utilities function                                       417

        Chapter 67: Guid                                                                                    418

          Introduction                                                                                       418


          Remarks                                                                                            418
          Examples                                                                                           418


            Getting the string representation of a Guid                                                      418
            Creating a Guid                                                                                  418

            Declaring a nullable GUID                                                                        419

        Chapter 68: Handling FormatException when converting string to other types                          420
   19   20   21   22   23   24   25   26   27   28   29