Core C# and.NET: The Complete and Comprehensive Developer's Guide to C# 2.0 and.NET 2.0

Core C# and.NET: The Complete and Comprehensive Developer's Guide to C# 2.0 and.NET 2.0

by Stephen C. Perry
     
 

ISBN-10: 0131472275

ISBN-13: 9780131472273

Pub. Date: 09/28/2005

Publisher: Prentice Hall

  • Written for C# 2.0 and .NET 2.0: contains coverage of generics, Master Pages, the DataGridView, and other new features
  • Covers Web development, Windows development, data management, security, threading, remoting, and much more
  • Presents hundreds of non-trivial code examples that help you solve real-world problems

The

Overview

  • Written for C# 2.0 and .NET 2.0: contains coverage of generics, Master Pages, the DataGridView, and other new features
  • Covers Web development, Windows development, data management, security, threading, remoting, and much more
  • Presents hundreds of non-trivial code examples that help you solve real-world problems

The Complete and Comprehensive Developer's Guide to C# 2.0 and .NET 2.0

Core C# and .NET is the no-nonsense, example-rich guide to achieving exceptional results with C# 2.0 and .NET 2.0. Writing for experienced programmers, Stephen Perry presents today's best practices for leveraging both C# 2.0 language features and Microsoft's .NET 2.0 infrastructure.

Like all books in the Core Series, Core C# and .NET focuses on solving real-world problems with serious, non-trivial code. Perry's broad, deep coverage ranges from new C# generics to Web services, from reflection to security. He systematically introduces the development of Windows Forms applications and the effective use of GDI+ graphics classes. He offers detailed guidance on data management with XML and ADO.NET, plus advanced coverage of threading, remoting, and code security. Finally, Perry presents an extensive section on Web development, covering ASP.NET, state management, HTTP requests, and much more.

With practical insights into everything from scalability to localization, this is the C# book you've been searching for: your definitive guide to building production-quality C# applications.

Core C# and .NET delivers

  • Best practices for building C#/.NET Windows applications, Web applications, and Web services
  • Expert insight into security, scalability, and other crucial issues
  • Hundreds of professional-quality code examples
  • In-depth coverage of the latest C# 2.0 features, including generics

EVERY CORE SERIES BOOK:

DEMONSTRATES practical techniques used by professional developers

FEATURES robust, thoroughly tested sample code and realistic examples

FOCUSES on the cutting-edge technologies you need to master today

PROVIDES expert advice that will help you build superior software

© Copyright Pearson Education. All rights reserved.

Product Details

ISBN-13:
9780131472273
Publisher:
Prentice Hall
Publication date:
09/28/2005
Series:
Core Series
Pages:
1008
Product dimensions:
7.00(w) x 9.35(h) x 1.88(d)

Table of Contents

About the Author.

Foreword.

Preface.

Acknowledgments.

I. FUNDAMENTALS OF C# PROGRAMMING AND INTRODUCTION TO .NET.

1. Introduction to .NET and C#.

Overview of the .NET Framework

Microsoft .NET and the CLI Standards

Common Language Runtime

Compiling .NET Code

Common Type System

Assemblies

Framework Class Library

Working with the .NET Framework and SDK

Updating the .NET Framework

.NET Framework Tools

Ildasm.exe

wincv.exe

Framework Configuration Tool

Understanding the C# Compiler

Locating the Compiler

Compiling from the Command Line

Summary

Test Your Understanding

2. C# Language Fundamentals.

The Layout of a C# Program

General C# Programming Notes

Primitives

decimal

bool

char

byte, sbyte

short, int, long

single, double

Using Parse and TryParse to Convert a Numeric String

Operators: Arithmetic, Logical, and Conditional

Arithmetic Operators

Conditional and Relational Operators

Control Flow Statements

if-else

switch

Loops

while loop

do loop

for loop

foreach loop

Transferring Control Within a Loop

C# Preprocessing Directives

Conditional Compilation

Diagnostic Directives

Code Regions

Strings

String Literals

String Manipulation

Enumerated Types

Working with Enumerations

System.Enum Methods

Enums and Bit Flags

Arrays

Declaring and Creating an Array

Using System.Array Methods and Properties

Reference and Value Types

System.Object and System.ValueType

Memory Allocation for Reference and Value Types

Boxing

Summary of Value and Reference Type Differences

Summary

Test Your Understanding

3. Class Design in C#.

Introduction to a C# Class

Defining a Class

Attributes

Access Modifiers

Abstract, Sealed, and Static Modifiers

Class Identifier

Base Classes, Interfaces, and Inheritance

Overview of Class Members

Member Access Modifiers

Constants, Fields, and Properties

Constants

Fields

Properties

Indexers

Methods

Method Modifiers

Passing Parameters

Constructors

Instance Constructor

Private Constructor

Static Constructor

Delegates and Events

Delegates

Delegate-Based Event Handling

Operator Overloading

Interfaces

Creating and Using a Custom Interface

Working with Interfaces

Generics

Structures

Defining Structures

Using Methods and Properties with a Structure

Structure Versus Class

Structures Are Value Types and Classes Are Reference Types

Unlike a Class, a Structure Cannot Be Inherited

General Rules for Choosing Between a Structure and a Class

Summary

Test Your Understanding

4. Working with Objects in C#.

Object Creation

Example: Creating Objects with Multiple Factories

Exception Handling

System.Exception Class

Writing Code to Handle Exceptions

Example: Handling Common SystemException Exceptions

How to Create a Custom Exception Class

Unhandled Exceptions

Exception Handling Guidelines

Implementing System.Object Methods in a Custom Class

ToString() to Describe an Object

Equals() to Compare Objects

Cloning to Create a Copy of an Object

Working with .NET Collection Classes and Interfaces

Collection Interfaces

System.Collections Namespace

Stack and Queue

ArrayList

Hashtable

System.Collections.Generic Namespace

Object Serialization

Binary Serialization

Object Life Cycle Management

.NET Garbage Collection

Summary

Test Your Understanding

II. CREATING APPLICATIONS USING THE .NET FRAMEWORK CLASS LIBRARY.

5. C# Text Manipulation and File I/O.

Characters and Unicode

Unicode

Working with Characters

The String Class

Creating Strings

Overview of String Operations

Comparing Strings

Using String.Compare

Using String.CompareOrdinal

Searching, Modifying, and Encoding a String's Content

Searching the Contents of a String

Searching a String That Contains Surrogates

String Transformations

String Encoding

StringBuilder

StringBuilder Class Overview

StringBuilder Versus String Concatenation

Formatting Numeric and DateTime Values

Constructing a Format Item

Formatting Numeric Values

Formatting Dates and Time

Regular Expressions

The Regex Class

Creating Regular Expressions

A Pattern Matching Example

Working with Groups

Examples of Using Regular Expressions

System.IO: Classes to Read and Write Streams of Data

The Stream Class

FileStreams

MemoryStreams

BufferedStreams

Using StreamReader and StreamWriter to Read and Write Lines of Text

StringWriter and StringReader

Encryption with the CryptoStream Class

System.IO: Directories and Files

FileSystemInfo

Working with Directories Using the DirectoryInfo, Directory, and Path Classes

Working with Files Using the FileInfo and File Classes

Summary

Test Your Understanding

6. Building Windows Forms Applications.

Programming a Windows Form

Building a Windows Forms Application by Hand

Windows.Forms Control Classes

The Control Class

Working with Controls

Control Events

The Form Class

Setting a Form's Appearance

Setting Form Location and Size

Displaying Forms

The Life Cycle of a Modeless Form

Forms Interaction--A Sample Application

Owner and Owned Forms

Message and Dialog Boxes

Multiple Document Interface Forms

Working with Menus

MenuItem Properties

Context Menus

Adding Help to a Form

ToolTips

Responding to F1 and the Help Button

The HelpProvider Component

Forms Inheritance

Building and Using a Forms Library

Using the Inherited Form

Summary

Test Your Understanding

7. Windows Forms Controls.

A Survey of .NET Windows Forms Controls

Button Classes, Group Box, Panel, and Label

The Button Class

The CheckBox Class

The RadioButton Class

The GroupBox Class

The Panel Class

The Label Class

PictureBox and TextBox Controls

The PictureBox Class

The TextBox Class

ListBox, CheckedListBox, and ComboBox Classes

The ListBox Class

Other List Controls: the ComboBox and the CheckedListBox

The ListView and TreeView Classes

The ListView Class

The TreeView Class

The ProgressBar, Timer, and StatusStrip Classes

Building a StatusStrip

Building Custom Controls

Extending a Control

Building a Custom UserControl

A UserControl Example

Using the Custom User Control

Working with the User Control at Design Time

Using Drag and Drop with Controls

Overview of Drag and Drop

Using Resources

Working with Resource Files

Using Resource Files to Create Localized Forms

Summary

Test Your Understanding

8. .NET Graphics Using GDI+.

GDI+ Overview

The Graphics Class

The Paint Event

Using the Graphics Object

Basic 2-D Graphics

Pens

Brushes

Colors

A Sample Project: Building a Color Viewer

Images

Loading and Storing Images

Manipulating Images

Sample Project: Working with Images

A Note on GDI and BitBlt for the Microsoft Windows Platform

Summary

Test Your Understanding

9. Fonts, Text, and Printing.

Fonts

Font Families

The Font Class

Drawing Text Strings

Drawing Multi-Line Text

Formatting Strings with the StringFormat Class

Using Tab Stops

String Trimming, Alignment, and Wrapping

Printing

Overview

PrintDocument Class

Printer Settings

Page Settings

PrintDocument Events

PrintPage Event

Previewing a Printed Report

A Report Example

Creating a Custom PrintDocument Class

Summary

Test Your Understanding

10. Working with XML in .NET.

Working with XML

Using XML Serialization to Create XML Data

XML Schema Definition (XSD)

Using an XML Style Sheet

Techniques for Reading XML Data

XmlReader Class

XmlNodeReader Class

The XmlReaderSettings Class

Using an XML Schema to Validate XML Data

Options for Reading XML Data

Techniques for Writing XML Data

Using XPath to Search XML

Constructing XPath Queries

XmlDocument and Xpath

XPathDocument and Xpath

XmlDataDocument and Xpath

Summary

Test Your Understanding

11. ADO.NET.

Overview of the ADO.NET Architecture

OLE DB Data Provider in .NET

.NET Data Provider

Data Access Models: Connected and Disconnected

Connected Model

Disconnected Model

ADO.NET Connected Model

Connection Classes

The Command Object

DataReader Object

DataSets, DataTables, and the Disconnected Model

The DataSet Class

DataTables

Loading Data into a DataSet

Using the DataAdapter to Update a Database

Defining Relationships Between Tables in a DataSet

Choosing Between the Connected and Disconnected Model

XML and ADO.NET

Using a DataSet to Create XML Data and Schema Files

Creating a DataSet Schema from XML

Reading XML Data into a DataSet

Summary

Test Your Understanding

12. Data Binding with Windows Forms Controls.

Overview of Data Binding

Simple Data Binding

Complex Data Binding with List Controls

One-Way and Two-Way Data Binding

Using Binding Managers

Using Simple and Complex Data Binding in an Application

Binding to a DataTable

Binding Controls to an ArrayList

Adding an Item to the Data Source

Identifying Updates

Update Original Database with Changes

The DataGridView Class

Properties

Events

Setting Up Master-Detail DataGridViews

Virtual Mode

Summary

Test Your Understanding

III. ADVANCED USE OF C# AND THE .NET FRAMEWORK.

13. Asynchronous Programming and Multithreading.

What Is a Thread?

Multithreading

Asynchronous Programming

Asynchronous Delegates

Examples of Implementing Asynchronous Calls

Working Directly with Threads

Creating and Working with Threads

Multithreading in Action

Using the Thread Pool

Timers

Thread Synchronization

The Synchronization Attribute

The Monitor Class

The Mutex

The Semaphore

Avoiding Deadlock

Summary of Synchronization Techniques

Summary

Test Your Understanding

14. Creating Distributed Applications with Remoting.

Application Domains

Advantages of AppDomains

Application Domains and Assemblies

Working with the AppDomain Class

Remoting

Remoting Architecture

Types of Remoting

Client-Activated Objects

Server-Activated Objects

Type Registration

Remoting with a Server-Activated Object

Remoting with a Client-Activated Object (CAO)

Design Considerations in Creating a Distributed Application

Leasing and Sponsorship

Leasing

Sponsorship

Summary

Test Your Understanding

15. Code Refinement, Security, and Deployment.

Following .NET Code Design Guidelines

Using FxCop

Strongly Named Assemblies

Creating a Strongly Named Assembly

Delayed Signing

Global Assembly Cache (GAC)

Versioning

Security

Permissions and Permission Sets

Evidence

Security Policies

Configuring Security Policy

The .NET Framework Configuration Tool

Configuring Code Access Security with the Configuration Tool--An Example

Requesting Permissions for an Assembly

Programmatic Security

Application Deployment Considerations

Microsoft Windows Deployment: XCOPY Deployment Versus the Windows Installer

Deploying Assemblies in the Global Assembly Cache

Deploying Private Assemblies

Using CodeBase Configuration

Using a Configuration File to Manage Multiple Versions of an Assembly

Assembly Version and Product Information

Summary

Test Your Understanding

IV. PROGRAMMING FOR THE INTERNET.

16. ASP.NET Web Forms and Controls.

Client-Server Interaction over the Internet

Web Application Example: Implementing a BMI Calculator

Using ASP.NET to Implement a BMI Calculator

Inline Code Model

The Code-Behind Model

Code-Behind with Partial Classes

Page Class

Web Forms Controls

Web Controls Overview

Specifying the Appearance of a Web Control

Simple Controls

List Controls

The DataList Control

Data Binding and Data Source Controls

Binding to a DataReader

Binding to a DataSet

DataSource Controls

Validation Controls

Using Validation Controls

Master and Content Pages

Creating a Master Page

Creating a Content Page

Accessing the Master Page from a Content Page

Building and Using Custom Web Controls

A Custom Control Example

Using a Custom Control

Control State Management

Composite Controls

Selecting a Web Control to Display Data

Summary

Test Your Understanding

17. The ASP.NET Application Environment.

HTTP Request and Response Classes

HttpRequest Object

HttpResponse Object

ASP.NET and Configuration Files

A Look Inside web.config

Adding a Custom Configuration Section

ASP.NET Application Security

Forms Authentication

An Example of Forms Authentication

Maintaining State

Application State

Session State

Caching

Page Output Caching

Data Caching

Creating a Web Client with WebRequest and WebResponse

WebRequest and WebResponse Classes

Web Client Example

HTTP Pipeline

Processing a Request in the Pipeline

HttpApplication Class

HTTP Modules

HTTP Handlers

Summary

Test Your Understanding

18. XML Web Services.

Introduction to Web Services

Discovering and Using a Web Service

Building an XML Web Service

Creating a Web Service by Hand

Creating a Web Service Using VS.NET

Extending the Web Service with the WebService and WebMethod Attributes

Building an XML Web Service Client

Creating a Simple Client to Access the Web Service Class

Creating a Proxy with Visual Studio.NET

Understanding WSDL and SOAP

Web Services Description Language (WSDL)

Simple Object Access Protocol (SOAP)

Using Web Services with Complex Data Types

A Web Service to Return Images

Using Amazon Web Services

Creating a Proxy for the Amazon Web Services

Building a WinForms Web Service Client

Web Services Performance

Configuring the HTTP Connection

Working with Large Amounts of Data

Summary

Test Your Understanding

Appendix A. Features Specific to .NET 2.0 and C# 2.0.

Appendix B. DataGridView Events and Delegates.

Answers to Chapter Exercises.

Index.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >