You are previewing Professional C# 2008.
O'Reilly logo
Professional C# 2008

Book Description

Professional C# 2008 starts by reviewing the overall architecture of .NET in Chapter 1 in order to give you the background you need to be able to write managed code. After that the book is divided into a number of sections that cover both the C# language and its application in a variety of areas.

Part I: The C# Language gives a good grounding in the C# language itself. This section doesn't presume knowledge of any particular language, although it does assume you are an experienced programmer. You start by looking at C#'s basic syntax and data types, and then explore the object-oriented features of C# before moving on to look at more advanced C# programming topics.

Part II: Visual Studio looks at the main IDE utilized by C# developers world-wide: Visual Studio 2005. The two chapters in this section look at the best way to use the tool to build applications based upon either the .NET Framework 2.0 or 3.0. In addition to this, this section also focuses on the deployment of your projects.

Part III: Base Class Libraries looks at the principles of programming in the .NET environment. In particular, you look at security, threading localization, transactions, how to build Windows services, and how to generate your own libraries as assemblies.

Part IV: Data looks at accessing databases with ADO.NET and LINQ, and at interacting with directories and files. This part also extensively covers support in .NET for XML and on the Windows operating system side, and the .NET features of SQL Server 2008. Within the large space of LINQ, particular focus is put on LINQ to SQL and LINQ to XML.

Part V: Presentation focuses on building classic Windows applications, which are called Windows Forms in .NET. Windows Forms are the thick-client version of applications, and using .NET to build these types of applications is a quick and easy way of accomplishing this task. In addition to looking at Windows Forms, you take a look at GDI+, which is the technology you will use for building applications that include advanced graphics. This section also covers writing components that will run on Web sites, serving up Web pages. This covers the tremendous number of new features that ASP.NET 3.5 provides. Finally, this section also shows how to build applications based upon the Windows Presentation Foundation and VSTO.

Part VI: Communication covers Web services for platform-independent communication, .NET Remoting for communication between .NET clients and servers, Enterprise Services for the services in the background, and DCOM communication. With Message Queuing asynchronous, disconnected communication is shown. This section also looks at utilizing the Windows Communication Foundation and the Windows Workflow Foundation.

Part VII: Appendices (Online): This section includes three appendices focused on how to build applications that take into account the new features and barriers found in Windows Vista. Also, this section looks at the upcoming ADO.NET Entities technology and how to use this new technology in your C# applications. You can find these three appendices online at www.wrox.com.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of Contents

  1. Cover
  2. Contents
  3. Title
  4. Copyright
  5. Dedication
  6. About the Authors
  7. Credits
  8. Acknowledgments
  9. Introduction
  10. Part I: The C# Language
    1. Chapter 1: .NET Architecture
      1. The Relationship of C# to .NET
      2. The Common Language Runtime
      3. A Closer Look at Intermediate Language
      4. Assemblies
      5. .NET Framework Classes
      6. Namespaces
      7. Creating .NET Applications Using C#
      8. The Role of C# in the .NET Enterprise Architecture
      9. Summary
    2. Chapter 2: C# Basics
      1. Before We Start
      2. Your First C# Program
      3. Variables
      4. Predefined Data Types
      5. Flow Control
      6. Enumerations
      7. Arrays
      8. Namespaces
      9. The Main() Method
      10. More on Compiling C# Files
      11. Console I/O
      12. Using Comments
      13. The C# Preprocessor Directives
      14. C# Programming Guidelines
      15. Summary
    3. Chapter 3: Objects and Types
      1. Classes and Structs
      2. Class Members
      3. Anonymous Types
      4. Structs
      5. Partial Classes
      6. Static Classes
      7. The Object Class
      8. Extension Methods
      9. Summary
    4. Chapter 4: Inheritance
      1. Types of Inheritance
      2. Implementation Inheritance
      3. Modifiers
      4. Interfaces
      5. Summary
    5. Chapter 5: Arrays
      1. Simple Arrays
      2. Multidimensional Arrays
      3. Jagged Arrays
      4. Array Class
      5. Array and Collection Interfaces
      6. Enumerations
      7. Summary
    6. Chapter 6: Operators and Casts
      1. Operators
      2. Type Safety
      3. Comparing Objects for Equality
      4. Operator Overloading
      5. User-Defined Casts
      6. Summary
    7. Chapter 7: Delegates and Events
      1. Delegates
      2. Events
      3. Summary
    8. Chapter 8: Strings and Regular Expressions
      1. System.String
      2. Regular Expressions
      3. Summary
    9. Chapter 9: Generics
      1. Overview
      2. Creating Generic Classes
      3. Generic Classes’ Features
      4. Generic Interfaces
      5. Generic Methods
      6. Generic Delegates
      7. Other Generic Framework Types
      8. Summary
    10. Chapter 10: Collections
      1. Collection Interfaces and Types
      2. Lists
      3. Queues
      4. Stacks
      5. Linked Lists
      6. Sorted Lists
      7. Dictionaries
      8. HashSet
      9. Bit Arrays
      10. Performance
      11. Summary
    11. Chapter 11: Language Integrated Query
      1. LINQ Overview
      2. Standard Query Operators
      3. Expression Trees
      4. LINQ Providers
      5. Summary
    12. Chapter 12: Memory Management and Pointers
      1. Memory Management Under the Hood
      2. Freeing Unmanaged Resources
      3. Unsafe Code
      4. Summary
    13. Chapter 13: Reflection
      1. Custom Attributes
      2. Reflection
      3. Summary
    14. Chapter 14: Errors and Exceptions
      1. Exception Classes
      2. Catching Exceptions
      3. User-Defined Exception Classes
      4. Summary
  11. Part II: Visual Studio
    1. Chapter 15: Visual Studio 2008
      1. Working with Visual Studio 2008
      2. Refactoring
      3. Multi-Targeting
      4. WPF, WCF, WF, and More
      5. Summary
    2. Chapter 16: Deployment
      1. Designing for Deployment
      2. Deployment Options
      3. Deployment Requirements
      4. Deploying the .NET Runtime
      5. Simple Deployment
      6. Installer Projects
      7. ClickOnce
      8. Summary
  12. Part III: Base Class Libraries
    1. Chapter 17: Assemblies
      1. What Are Assemblies?
      2. Creating Assemblies
      3. Dynamic Loading and Creating Assemblies
      4. Application Domains
      5. Shared Assemblies
      6. Configuring .NET Applications
      7. Versioning
      8. Summary
    2. Chapter 18: Tracing and Events
      1. Tracing
      2. Event Logging
      3. Performance Monitoring
      4. Summary
    3. Chapter 19: Threading and Synchronization
      1. Overview
      2. Asynchronous Delegates
      3. The Thread Class
      4. Thread Pools
      5. Threading Issues
      6. Synchronization
      7. Timers
      8. COM Apartments
      9. Event-Based Asynchronous Pattern
      10. Summary
    4. Chapter 20: Security
      1. Authentication and Authorization
      2. Encryption
      3. Access Control to Resources
      4. Code Access Security
      5. Managing Security Policies
      6. Summary
    5. Chapter 21: Localization
      1. Namespace System.Globalization
      2. Resources
      3. Windows Forms Localization Using Visual Studio
      4. Localization with ASP.NET
      5. Localization with WPF
      6. A Custom Resource Reader
      7. Creating Custom Cultures
      8. Summary
    6. Chapter 22: Transactions
      1. Overview
      2. Database and Entity Classes
      3. Traditional Transactions
      4. System.Transactions
      5. Isolation Level
      6. Custom Resource Managers
      7. Transactions with Windows Vista and Windows Server 2008
      8. Summary
    7. Chapter 23: Windows Services
      1. What Is a Windows Service?
      2. Windows Services Architecture
      3. System.ServiceProcess Namespace
      4. Creating a Windows Service
      5. Monitoring and Controlling the Service
      6. Troubleshooting
      7. Power Events
      8. Summary
    8. Chapter 24: Interoperability
      1. .NET and COM
      2. Marshaling
      3. Using a COM Component from a .NET Client
      4. Using a .NET Component from a COM Client
      5. Platform Invoke
      6. Summary
  13. Part IV: Data
    1. Chapter 25: Manipulating Files and the Registry
      1. Managing the File System
      2. Moving, Copying, and Deleting Files
      3. Reading and Writing to Files
      4. Reading Drive Information
      5. File Security
      6. Reading and Writing to the Registry
      7. Reading and Writing to Isolated Storage
      8. Summary
    2. Chapter 26: Data Access
      1. ADO.NET Overview
      2. Using Database Connections
      3. Commands
      4. Fast Data Access: The Data Reader
      5. Managing Data and Relationships: The DataSet Class
      6. XML Schemas: Generating Code with XSD
      7. Populating a DataSet
      8. Persisting DataSet Changes
      9. Working with ADO.NET
      10. Summary
    3. Chapter 27: LINQ to SQL
      1. LINQ to SQL and Visual Studio 2008
      2. How Objects Map to LINQ Objects
      3. Working Without the O/R Designer
      4. Custom Objects and the O/R Designer
      5. Querying the Database
      6. Stored Procedures
      7. Summary
    4. Chapter 28: Manipulating XML
      1. XML Standards Support in .NET
      2. Introducing the System.Xml Namespace
      3. Using System.Xml Classes
      4. Reading and Writing Streamed XML
      5. Using the DOM in .NET
      6. Using XPathNavigators
      7. XML and ADO.NET
      8. Serializing Objects in XML
      9. Summary
    5. Chapter 29: LINQ to XML
      1. LINQ to XML and .NET 3.5
      2. New XML Objects from the .NET Framework 3.5
      3. Using LINQ to Query XML Documents
      4. Working Around the XML Document
      5. Using LINQ to SQL with LINQ to XML
      6. Summary
    6. Chapter 30: .NET Programming with SQL Server
      1. .NET Runtime Host
      2. Microsoft.SqlServer.Server
      3. User-Defined Types
      4. Stored Procedures
      5. User-Defined Functions
      6. Triggers
      7. XML Data Type
      8. Summary
  14. Part V: Presentation
    1. Chapter 31: Windows Forms
      1. Creating a Windows Form Application
      2. Control Class
      3. Standard Controls and Components
      4. Forms
      5. Summary
    2. Chapter 32: Data Binding
      1. The DataGridView Control
      2. DataGridView Class Hierarchy
      3. Data Binding
      4. Visual Studio .NET and Data Access
      5. Summary
    3. Chapter 33: Graphics with GDI+
      1. Understanding Drawing Principles
      2. Measuring Coordinates and Areas
      3. A Note About Debugging
      4. Drawing Scrollable Windows
      5. World, Page, and Device Coordinates
      6. Colors
      7. The Safety Palette
      8. Pens and Brushes
      9. Drawing Shapes and Lines
      10. Displaying Images
      11. Issues When Manipulating Images
      12. Drawing Text
      13. Simple Text Example
      14. Fonts and Font Families
      15. Example: Enumerating Font Families
      16. Editing a Text Document: The CapsEditor Sample
      17. Printing
      18. Summary
    4. Chapter 34: Windows Presentation Foundation
      1. Overview
      2. Shapes
      3. Transformation
      4. Brushes
      5. Controls
      6. Layout
      7. Event Handling
      8. Styles, Templates, and Resources
      9. Summary
    5. Chapter 35: Advanced WPF
      1. Data Binding
      2. Command Bindings
      3. Animations
      4. Adding 3-D Features in WPF
      5. Windows Forms Integration
      6. WPF Browser Application
      7. Summary
    6. Chapter 36: Add-Ins
      1. System.AddIn Architecture
      2. Add-In Sample
      3. Summary
    7. Chapter 37: ASP.NET Pages
      1. ASP.NET Introduction
      2. ASP.NET Web Forms
      3. ADO.NET and Data Binding
      4. Application Configuration
      5. Summary
    8. Chapter 38: ASP.NET Development
      1. User and Custom Controls
      2. Master Pages
      3. Site Navigation
      4. Security
      5. Themes
      6. Web Parts
      7. Summary
    9. Chapter 39: ASP.NET AJAX
      1. What Is Ajax?
      2. What Is ASP.NET AJAX?
      3. Using ASP.NET AJAX
      4. Summary
    10. Chapter 40: Visual Studio Tools for Office
      1. VSTO Overview
      2. VSTO Fundamentals
      3. Building VSTO Solutions
      4. Example Application
      5. VBA Interoperability
      6. Summary
  15. Part VI: Communication
    1. Chapter 41: Accessing the Internet
      1. The WebClient Class
      2. WebRequest and WebResponse Classes
      3. Displaying Output as an HTML Page
      4. Utility Classes
      5. Lower-Level Protocols
      6. Summary
    2. Chapter 42: Windows Communication Foundation
      1. WCF Overview
      2. Simple Service and Client
      3. Contracts
      4. Service Implementation
      5. Binding
      6. Hosting
      7. Clients
      8. Duplex Communication
      9. Summary
    3. Chapter 43: Windows Workflow Foundation
      1. Hello World
      2. Activities
      3. Custom Activities
      4. Workflows
      5. The Workflow Runtime
      6. Workflow Services
      7. Integration with Windows Communication Foundation
      8. Hosting Workflows
      9. The Workflow Designer
      10. Summary
    4. Chapter 44: Enterprise Services
      1. Overview
      2. Creating a Simple COM+ Application
      3. Deployment
      4. Component Services Explorer
      5. Client Application
      6. Transactions
      7. Sample Application
      8. Integrating WCF and Enterprise Services
      9. Summary
    5. Chapter 45: Message Queuing
      1. Overview
      2. Message Queuing Products
      3. Message Queuing Architecture
      4. Message Queuing Administrative Tools
      5. Programming Message Queuing
      6. Course Order Application
      7. Receiving Results
      8. Transactional Queues
      9. Message Queuing with WCF
      10. Message Queue Installation
      11. Summary
    6. Chapter 46: Directory Services
      1. The Architecture of Active Directory
      2. Administration Tools for Active Directory
      3. Programming Active Directory
      4. Searching for User Objects
      5. Account Management
      6. DSML
      7. Summary
    7. Chapter 47: Peer-to-Peer Networking
      1. Peer-to-Peer Networking Overview
      2. Microsoft Windows Peer-to-Peer Networking
      3. Building P2P Applications
      4. Summary
    8. Chapter 48: Syndication
      1. Overview of System.Servicemodel.Syndication
      2. Syndication Reader
      3. Offering Syndication Feeds
      4. Summary
  16. Part VII: Appendices
    1. Appendix A: ADO.NET Entity Framework
    2. Appendix B: C#, Visual Basic, and C++/CLI
    3. Appendix C: Windows Vista and Windows Server 2008
  17. Index