Introduction


C# is a language that follows in a grand tradition of programming language design; it draws its influences from C++ and Java, and even Delphi and Visual Basic – a rich inheritance, which provides it with much that is familiar to many developers, but also much that is alien or unexpected.

Programmers unfamiliar with object-oriented, C-family, ‘curly-bracket’ languages, perhaps coming to C# from a background with Visual Basic 6 or ASP VBScript, often find the scope of the object-oriented features in C# daunting. Those coming from other object-oriented platforms – C++ or Java for example – find some of C#'s additional facilities surprising or confusing, while other, seemingly familiar syntaxes can behave in curiously different ways.

This book takes the lid off C#'s object-oriented model, and examines how we use C# as a language for creating classes (and, indeed, other kinds of types). Since everything we code in C# is a type, all our logic belongs to methods of types, and the state of our program at any moment is tied up in the values stored in the fields of instances of types in memory. A good understanding of how to create those types is therefore fundamental to good C# programming.

We'll explore what options C# gives us in declaring types and type members in our code, and the impact our decisions will have on code that uses our types. We'll see how we can code differently when our types are for public use, and when types are for use within our own code. We'll look at what we can do to ensure our types are only used in ways we design for, and how we can expose functionality from our types in a consistent, logical, predictable, and user-friendly manner, for other code to exploit.

Who Is This Book For?

This book is for C# developers who want to explore the full capabilities of the .NET platform. If you want to define your own data types, build your own class hierarchies, and build classes with robust interfaces, then you need a deep understanding of the mechanisms C# provides for defining classes. That is the subject of this book.

This book assumes you're already coding with C#, you're already familiar with the basic syntax, and you're regularly writing code that works. You should be familiar with your chosen development tools and know how to compile and run C# code.

You should be aware of .NET's basic object-orientation mechanisms – for example, that objects are instances of classes, how objects are instantiated, and how methods and properties on an object are accessed. We'll recap on the meaning and syntax of most of C#'s class construction keywords as we discuss them, however.




C# Class Design Handbook(c) Coding Effective Classes
C# Class Design Handbook: Coding Effective Classes
ISBN: 1590592573
EAN: 2147483647
Year: N/A
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net