C# Class Design Handbook

What does this book cover?

C# is Microsoft's new object-oriented language, specifically designed to take full advantage of the .NET type system. At the heart of .NET programming in C# is the task of building classes. All C# code participates in the .NET type system, because all code is contained in classes and other types which participate in the class hierarchy of the .NET framework.

This book is a guide to help you design these classes effectively, by looking at what control we have over our classes, and how C# turns our class definitions into executable code.

Ask anyone: designing effective classes that you do not have to revisit and revise over and over again is an art. This Handbook aims to give you a deep understanding of the implications of every decision you can make in designing a class, so you are better equipped to take full advantage of C#'s power to create classes that are robust, flexible and reusable.

What will you learn?

  • The role of types in .NET.
  • The different kinds of type you can create in C#.
  • The fundamental role of methods as constrainers of program logic.
  • C#'s special method syntaxes: properties, indexers and operators.
  • The role of constructors and their effective use.
  • Object cleanup and disposal.
  • How .NET's delegate-based event management works.
  • How to control and exploit inheritance in your types.
  • Logical and physical code organisation through namespaces and assemblies.

Who is this book for?

This book assumes that you are already familiar with the syntax of C#. It assumes that you have already used it to write code and that you are familiar with your chosen development tools and know how to compile and run C# code.

You should also be aware of .NET's basic object-oriented mechanisms.

In this book, we will lift the lid on the simple syntax and examine what it really does behind the scenes.