Core C# and .NET
< Day Day Up > |
Chapter 3. Class Design in C#
Topics in This Chapter
This chapter provides an advanced introduction to using classes within the .NET environment. It is not a primer on object-oriented programming (OOP) and assumes you have some familiarity with the principles of encapsulation, inheritance, and polymorphism. C# is rich in object-oriented features, and the first challenge in working with classes is to understand the variety of syntactical contstructs. At the same time, it is necessary to appreciate the interaction between C# and .NET. Not only does the Framework Class Library (FCL) provide thousands of predefined classes, but it also provides a hierarchy of base classes from which all C# classes are derived. The chapter presents topics in a progressive fashion each section building on the previous. If you are new to C#, you should read from beginning to end; if you're familiar with the concepts and syntax, read sections selectively. The chapter begins by presenting the syntactical construct of a class and then breaks it down in detail. Attributes, modifiers, and members of the class body (constructors, properties, fields, and methods) are all explained. Sprinkled throughout are recommended .NET guidelines and best practices for designing and using custom classes. The objective is to show not only how to use classes, but also encourage good design practices that result in efficient code. |
< Day Day Up > |