Beschreibung
This book shows readers how to get the most out of C# using Object Orientation. The author takes a hands-on approach to learning C# and object orientation, using lots of worked examples. The text provides an ideal base from which to start programming. After introducing the C# language and object orientation, John Hunt goes on to explain: how to construct a user interface for a simple editor; how to obtain information on files and directories and how objects can be stored and restored using serialization. Presents C# and objectorientation as a coherent whole, using one to strengthen the presentation of the other Includes lots of complete and worked examples to clarify readers'understanding The source code for the examples is available at: http://www.guidetocsharp.net Hunt is a successful Springer author, and this book is written in the same style as his Java for Practitioners
Autorenportrait
Inhaltsangabe1 Introduction to Object Orientation.- 1 Introduction to Object Orientation.- 1.1 Introduction.- 1.2 Programming Paradigms.- 1.3 Revolution Versus Evolution.- 1.4 Why Learn a New Programming Paradigm?.- 1.4.1 Software Industry Blues.- 1.4.2 The Advantages Claimed for Object Orientation.- 1.4.3 What Are the Problems and Pitfalls of Object Orientation?.- 1.5 Fundamentals of Object Orientation.- 1.6 The Basic Principles of Object Orientation.- 1.7 Encapsulation.- 1.8 Inheritance.- 1.9 Abstraction.- 1.10 Polymorphism.- 1.10.1 Overloading Operators.- 1.10.2 Overriding Operators.- 1.11 Summary.- 1.12 Further Reading.- 2 Elements of Object Orientation.- 2.1 Introduction.- 2.2 Terminology.- 2.3 Types of Hierarchy.- 2.4 The Move to Object Technology.- 2.5 Summary.- 2.6 Exercises.- 2.7 Further Reading.- 2 Introduction to the C# Language.- 3 Why Object Orientation?.- 3.1 Introduction.- 3.2 The Procedural Approach.- 3.2.1 A Naked Data Structure.- 3.2.2 Procedures for the Data Structure.- 3.2.3 Packages.- 3.3 Does Object Orientation Do Better?.- 3.3.1 Packages Versus Classes.- 3.3.2 Inheritance.- 3.4 Summary.- 4 Constructing an Object-Oriented System.- 4.1 Introduction.- 4.2 The Application: Windscreen Wipe Simulation.- 4.3 Where Do We Start?.- 4.4 Identifying the Objects.- 4.5 Identifying the Services or Methods.- 4.6 Refining the Objects.- 4.7 Bringing it all Together.- 4.8 Where is the Structure?.- 4.9 Summary.- 4.10 Exercises.- 4.11 Further Reading.- 5 An Introduction to C#.- 5.1 Introduction.- 5.2 Background.- 5.3 What Is C#?.- 5.4 Objects in C#.- 5.5 Commercial Versions of C#.- 5.6 The C# Environment.- 5.7 Comparing C# to Java and C++.- 5.8 C# Keywords.- 5.9 Where to Get More Information.- 6 A Little C#.- 6.1 Introduction.- 6.2 Setting Up the Development Environment.- 6.3 Compiling and Executing C#.- 6.4 Summary.- 7 C# Classes.- 7.1 Introduction.- 7.2 The Basics of the Language.- 7.2.1 Some Terminology.- 7.2.2 The Message-Passing Mechanism.- 7.2.3 The Statement Terminator.- 7.3 Classes.- 7.3.1 Class Definitions.- 7.3.2 Classes and Messages.- 7.3.3 Instances and Instance Variables.- 7.3.4 Classes and Inheritance.- 7.3.5 Instance Creation.- 7.3.6 Constructors.- 7.3.7 Static Constructors Blocks.- 7.3.8 Finalize Methods.- 7.3.9 Supplied Classes.- 7.4 Method Definitions.- 7.4.1 The Comments Section.- 7.4.2 The Local Variables Section.- 7.4.3 The Statements Section.- 7.4.4 The Return Operator.- 7.4.5 An Example Method.- 7.4.6 Static Fields and Methods.- 7.4.7 Constants.- 7.4.8 Read-Only Fields.- 7.4.9 Properties and Indexers.- 8 Structs and Enumerations.- 8.1 Introduction.- 8.2 Structs in C#.- 8.3 Initialization of Structs.- 8.4 Structs and Constructors.- 8.5 Immutable Structs.- 8.6 Enumerations.- 8.7 Enumeration Foundations.- 8.8 Initialization of Enumeration Values.- 8.9 Zero and Enumerations.- 8.10 Bit Flag Enumerations.- 8.11 System Support for Enumerations.- 9 Interfaces.- 9.1 Introduction.- 9.2 Interface Definitions.- 9.3 Interfaces Versus Abstract Classes.- 9.4 Implementing an Interface.- 9.5 Using Interfaces.- 9.6 Multiple Inheritance and Interfaces.- 9.7 Implementing Interfaces and Extending a Superclass.- 9.8 Method Hiding.- 9.9 Interfaces and Structs.- 10 C# Constructs.- 10.1 Introduction.- 10.2 Data Types.- 10.3 Numbers and Numeric Operators.- 10.3.1 Numeric Values.- 10.3.2 Built-In Arithmetic Operators.- 10.3.3 User-Defined Operators.- 10.3.4 Type Operators.- 10.4 Assignments.- 10.5 Compound Assignment.- 10.6 Variables.- 10.6.1 Temporary Variables.- 10.6.2 The this Pseudo-Variable.- 10.6.3 Variable Scope.- 10.6.4 Special Values - true, fal se and null.- 10.7 Messages and Message Selectors.- 10.7.1 Invoking Methods.- 10.7.2 Precedence.- 10.8 Checked and Unchecked Expressions.- 10.9 Summary.- 11 Characters and Strings.- 11.1 Introduction.- 11.2 Characters.- 11.3 Strings.- 11.4 Converting Objects to Strings.- 11.5 Strings and Stri ngBui l der.- 11.6 Regular Expressions.- 11.7 String Formatting.- 11.8 String Encoding.- 12 An Examp