Chapter 13. A Deeper Look at C#

We're almost ready to develop the Student Registration System (SRS) application in C#, based on the UML model that we created in Part Two. Before we dive into the specifics of coding the SRS, however, there are a number of additional C# language features that we want to cover, many of which we'll put to use in building the SRS.

Realize that we can't do justice to all of the remaining features of the C# language in just one chapter; C# is an extremely rich language, and most good C# references are many hundreds of pages long. Our goal isn't to duplicate the hard work that has gone into existing C# reference books, but instead to complement them by showing you how to bridge the gap between producing an object model and turning it into C# code—something that few, if any, other books do.

With that in mind, we'll be selective in terms of which aspects of the C# language we introduce in this chapter: namely, those that are most critical to understanding the SRS coding examples that follow in Chapters 14 through 16. Nonetheless, you'll have gone from "concept to code" and will acquire a very respectable working knowledge of C# by the time that we've finished.

Even if you've already been programming in C# for a while, and thus feel that you have a fairly good grasp of the language syntax, we encourage you to at least skim this chapter before moving on to Chapter 14 because we'll mention a few things along the way with regard to how we'll be approaching the SRS.


In this chapter, you'll learn about the following:

  • The C# notion of namespaces—how to define them and why we use them

  • The object nature of a string, and some of the methods/properties provided to manipulate them

  • The Object class, a predefined class that is the ultimate base class of every C# type

  • Using a special keyword, this, to "self-reference" an object from within one of its own methods

  • The object nature of arrays and some of the methods/properties provided to manipulate them

  • The List and Dictionary classes, two of the .NET Framework generic collection classes

  • The nature of object identities in C#, how to discover the true class that an object belongs to, and how to test the equality of two C# objects

  • Important variants on the Main method and the base keyword

  • How auto-implemented properties can be used to simplify code listings

  • How dynamically created objects are deleted to recycle their memory and the role that the common language runtime (CLR) garbage collector plays in this recycling

  • A .NET Framework language construct called an attribute

We'll also revisit some of the topics that we introduced in earlier chapters to provide you with additional insights.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset