You are previewing Essential C# 5.0.

Essential C# 5.0

Cover of Essential C# 5.0 by Mark Michaelis... Published by Addison-Wesley Professional
  1. Title Page
  2. Copyright Page
  3. Microsoft Windows Development Series
  4. Dedication Page
  5. Contents at a Glance
  6. Contents
  7. Figures
  8. Tables
  9. Foreword
  10. Preface
    1. Target Audience for This Book
    2. Features of This Book
    3. How This Book Is Organized
  11. Acknowledgments
  12. About the Authors
  13. 1. Introducing C#
    1. Hello, World
    2. C# Syntax Fundamentals
    3. Console Input and Output
    4. Summary
  14. 2. Data Types
    1. Fundamental Numeric Types
    2. More Fundamental Types
    3. null and void
    4. Categories of Types
    5. Nullable Modifier
    6. Conversions between Data Types
    7. Arrays
    8. Summary
  15. 3. Operators and Control Flow
    1. Operators
    2. Introducing Flow Control
    3. Code Blocks ({})
    4. Code Blocks, Scopes, and Declaration Spaces
    5. Boolean Expressions
    6. Bitwise Operators (<<, >>, |, &, ^, ~)
    7. Control Flow Statements, Continued
    8. Jump Statements
    9. C# Preprocessor Directives
    10. Summary
  16. 4. Methods and Parameters
    1. Calling a Method
    2. Declaring a Method
    3. The using Directive
    4. Returns and Parameters on Main()
    5. Advanced Method Parameters
    6. Recursion
    7. Method Overloading
    8. Optional Parameters
    9. Basic Error Handling with Exceptions
    10. Summary
  17. 5. Classes
    1. Declaring and Instantiating a Class
    2. Instance Fields
    3. Instance Methods
    4. Using the this Keyword
    5. Access Modifiers
    6. Properties
    7. Constructors
    8. Static Members
    9. Extension Methods
    10. Encapsulating the Data
    11. Nested Classes
    12. Partial Classes
    13. Summary
  18. 6. Inheritance
    1. Derivation
    2. Overriding the Base Class
    3. Abstract Classes
    4. All Classes Derive from System.Object
    5. Verifying the Underlying Type with the is Operator
    6. Conversion Using the as Operator
    7. Summary
  19. 7. Interfaces
    1. Introducing Interfaces
    2. Polymorphism through Interfaces
    3. Interface Implementation
    4. Converting between the Implementing Class and Its Interfaces
    5. Interface Inheritance
    6. Multiple Interface Inheritance
    7. Extension Methods on Interfaces
    8. Implementing Multiple Inheritance via Interfaces
    9. Versioning
    10. Interfaces Compared with Classes
    11. Interfaces Compared with Attributes
    12. Summary
  20. 8. Value Types
    1. Structs
    2. Boxing
    3. Enums
    4. Summary
  21. 9. Well-Formed Types
    1. Overriding object Members
    2. Operator Overloading
    3. Referencing Other Assemblies
    4. Defining Namespaces
    5. XML Comments
    6. Garbage Collection
    7. Resource Cleanup
    8. Lazy Initialization
    9. Summary
  22. 10. Exception Handling
    1. Multiple Exception Types
    2. Catching Exceptions
    3. General Catch Block
    4. Guidelines for Exception Handling
    5. Defining Custom Exceptions
    6. Wrapping an Exception and Rethrowing
    7. Summary
  23. 11. Generics
    1. C# without Generics
    2. Introducing Generic Types
    3. Constraints
    4. Generic Methods
    5. Covariance and Contravariance
    6. Generic Internals
    7. Summary
  24. 12. Delegates and Lambda Expressions
    1. Introducing Delegates
    2. Lambda Expressions
    3. Anonymous Methods
    4. General-Purpose Delegates: System.Func and System.Action
    5. Summary
  25. 13. Events
    1. Coding the Observer Pattern with Multicast Delegates
    2. Events
    3. Summary
  26. 14. Collection Interfaces with Standard Query Operators
    1. Anonymous Types and Implicitly Typed Local Variables
    2. Collection Initializers
    3. What Makes a Class a Collection: IEnumerable<T>
    4. Standard Query Operators
    5. Summary
  27. 15. LINQ with Query Expressions
    1. Introducing Query Expressions
    2. Query Expressions Are Just Method Invocations
    3. Summary
  28. 16. Building Custom Collections
    1. More Collection Interfaces
    2. Primary Collection Classes
    3. Providing an Indexer
    4. Returning Null or an Empty Collection
    5. Iterators
    6. Summary
  29. 17. Reflection, Attributes, and Dynamic Programming
    1. Reflection
    2. Attributes
    3. Programming with Dynamic Objects
    4. Summary
  30. 18. Multithreading
    1. Multithreading Basics
    2. Working with System.Threading
    3. Asynchronous Tasks
    4. Canceling a Task
    5. The Task-Based Asynchronous Pattern in C# 5.0
    6. Executing Loop Iterations in Parallel
    7. Running LINQ Queries in Parallel
    8. Summary
  31. 19. Thread Synchronization
    1. Why Synchronization?
    2. Timers
    3. Summary
  32. 20. Platform Interoperability and Unsafe Code
    1. Using the Windows Runtime Libraries from C#
    2. Platform Invoke
    3. Pointers and Addresses
    4. Executing Unsafe Code via a Delegate
    5. Summary
  33. 21. The Common Language Infrastructure
    1. Defining the Common Language Infrastructure (CLI)
    2. CLI Implementations
    3. C# Compilation to Machine Code
    4. Runtime
    5. Application Domains
    6. Assemblies, Manifests, and Modules
    7. Common Intermediate Language (CIL)
    8. Common Type System (CTS)
    9. Common Language Specification (CLS)
    10. Base Class Library (BCL)
    11. Metadata
    12. Summary
  34. A. Downloading and Installing the C# Compiler and CLI Platform
    1. Microsoft’s .NET
  35. B. Tic-Tac-Toe Source Code Listing
  36. C. Interfacing with Mutithreading Patterns Prior to the TPL and C# 5.0
    1. Asynchronous Programming Model
    2. Asynchronous Delegate Invocation
    3. The Event-based Asynchronous Pattern (EAP)
    4. Background Worker Pattern
    5. Dispatching to the Windows UI
  37. D. Timers Prior to the Async/Await Pattern of C# 5.0
  38. Index
  39. Index of 5.0 Topics
  40. Index of 4.0 Topics
  41. Index of 3.0 Topics
  42. IntelliTect
  43. Ad Page
O'Reilly logo

6. Inheritance

The preceding chapter discussed how one class can reference other classes via fields and properties. This chapter discusses how to use the inheritance relationship between classes to build class hierarchies that form an “is a” relationship.

Image

The best content for your career. Discover unlimited learning on demand for around $1/day.