O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C# Primer: A Practical Approach

Book Description

Using his famous primer format, best-selling author Stan Lippman now brings you an indispensable guide to C#. C# PRIMER is a comprehensive, example-driven introduction to this new object-oriented programming language.

C# is a cornerstone of Microsoft's new .NET platform. Inheriting many features from both Java™ and C++, C# is destined to become the high-level programming language of choice for building high-performance Windows® and Web applications and components--from XML-based Web services to middle-tier business objects and system-level applications.


  • Coverage of fundamentals, such as namespaces, exception handling, and the unified type system

  • Detailed explanations and examples of both class and interface inheritance, including a discussion of when each is appropriate

  • A wide-ranging tour of the .NET class library, including an introduction to ADO.NET, establishing database connections, regular expressions, threading, sockets programming, XML programming using the firehose and DOM parser models, XSLT, and XPATH

  • Detailed discussion of ASP.NET Web Form Designer, walking through the page life cycle and caching, and providing a large number of examples

  • Introduction to .NET Common Language Runtime (CLR)

Adding C# to your toolbox will not only improve your Web-based programming ability, it will increase your productivity. C# PRIMER provides a solid foundation to build upon and a refreshingly unbiased voice on Microsoft's vehicle to effective and efficient Web-based programming.


Table of Contents

  1. Copyright
  2. Preface
  3. Hello, C#
    1. A First C# Program
    2. Namespaces
    3. Alternative Forms of the Main() Function
    4. Making a Statement
    5. Opening a Text File for Reading and Writing
    6. Formatting Output
    7. The string Type
    8. Local Objects
    9. Value and Reference Types
    10. The C# Array
    11. The new Expression
    12. Garbage Collection
    13. Dynamic Arrays: The ArrayList Collection Class
    14. The Unified Type System
    15. Jagged Arrays
    16. The Hashtable Container
    17. Exception Handling
    18. A Basic Language Handbook for C#
  4. Class Design
    1. Our First Independent Class
    2. Opening a New Visual Studio Project
    3. Declaring Data Members
    4. Properties
    5. Indexers
    6. Member Initialization
    7. The Class Constructor
    8. The Implicit this Reference
    9. static Class Members
    10. const and readonly Data Members
    11. The enum Value Type
    12. The delegate Type
    13. Function Parameter Semantics
    14. Function Overloading
    15. Variable-Length Parameter Lists
    16. Operator Overloading
    17. Conversion Operators
    18. The Class Destructor
    19. The struct Value Type
  5. Object-Oriented Programming
    1. Object-Oriented Programming Concepts
    2. Supporting a Polymorphic Query Language
    3. Designing a Class Hierarchy
    4. Object Lessons
    5. Designing an Abstract Base Class
    6. Declaring an Abstract Base Class
    7. Static Members of an Abstract Base Class
    8. A Hybrid Abstract Base Class
    9. Defining a Derived Class
    10. Overriding the Inherited Virtual Interface
    11. Overriding the Virtual Object Methods
    12. Member Access: The new and base Modifiers
    13. Sealing a Class
    14. The Exception Class Hierarchy
  6. Interface Inheritance
    1. Implementing a System Interface: IComparable
    2. Accessing an Existing Interface
    3. Defining an Interface
    4. Explicit Interface Member Implementations
    5. Inherited Interface Members
    6. Overloaded, Hidden, or Ambiguous?
    7. Mastering Copy Semantics: ICloneable
    8. Mastering Finalize Semantics: IDisposable
    9. BitVectorx: Extension through Composition
  7. Exploring the System Namespace
    1. Supporting the Fundamental Types
    2. The Array Is a System.Array
    3. Querying the Environment
    4. System.IO
    5. A System Miscellany
    6. Regular Expressions
    7. System.Threading
    8. The Web Request/Response Model
    9. System.Net.Sockets
    10. System.Data
    11. System.Xml
  8. Windows Forms Designer
    1. Our First Windows Forms Program
    2. Building the GUI
    3. Implementing the Event Callback Routines
    4. Inspecting and Generating Control Events
    5. Implementing the MessageBox Pop-Up Dialog
    6. The List Box for Unformatted Output
    7. Exploring the File Dialog
    8. A Pocketful of Buttons
    9. Serving Up Menus
    10. The DataGrid Control
    11. Adding a PictureBox Control
  9. ASP.NET and Web Forms Designer
    1. Our First Web Forms Program
    2. Opening an ASP.NET Web Application Project
    3. Adding Pages to a Project
    4. The HyperLink Control: Linking to Other Pages
    5. The DataGrid Control
    6. Understanding the Page Event Life Cycle
    7. The Data Provider
    8. Web State Management
    9. Managing State: Class Members
    10. Managing State: The Session Object
    11. Managing State: The Application Object
    12. Validation Controls
    13. Adding a DropDownList Control
    14. Adding a Group of RadioButton Controls
    15. Adding a CheckBoxList Control
    16. Adding Validators to a Control
    17. Adding a Calendar Control
    18. Adding an Image Control
    19. Programming Web Server Controls
  10. The Common Language Runtime
    1. Assemblies
    2. Runtime Type Reflection
    3. Modifying the Retrieval through BindingFlags
    4. Invoking a Method during Runtime
    5. Delegating the Test to Reflection
    6. Attributes
    7. Implementing Our Own Attribute Class
    8. Runtime Discovery of Attributes Using Reflection
    9. The Intermediate Language
  11. Index