25.12.2015 Views

Professional

1l6xhbR

1l6xhbR

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149<br />

Quick reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150<br />

PART II<br />

UNDERSTANDING THE C# OBJECT MODEL<br />

Chapter 7 Creating and managing classes and objects 153<br />

Understanding classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153<br />

The purpose of encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154<br />

Defining and using a class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154<br />

Controlling accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156<br />

Working with constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157<br />

Overloading constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158<br />

Understanding static methods and data . . . . . . . . . . . . . . . . . . . . . . . . . . .167<br />

Creating a shared field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168<br />

Creating a static field by using the const keyword . . . . . . . . . . . . . .169<br />

Understanding static classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169<br />

Static using statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170<br />

Anonymous classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172<br />

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174<br />

Quick reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174<br />

Chapter 8 Understanding values and references 177<br />

Copying value type variables and classes . . . . . . . . . . . . . . . . . . . . . . . . . . .177<br />

Understanding null values and nullable types . . . . . . . . . . . . . . . . . . . . . . .183<br />

Using nullable types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185<br />

Understanding the properties of nullable types . . . . . . . . . . . . . . .186<br />

Using ref and out parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187<br />

Creating ref parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188<br />

Creating out parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188<br />

How computer memory is organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190<br />

Using the stack and the heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192<br />

The System.Object class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193<br />

Boxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194<br />

viii<br />

Contents

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!