About the Book
Microsoft Visual C# .NET
2003 Unleashed is a comprehensive reference and learning guide for the
.NET Framework, using C# as the instructional language. You will be exposed
to everything from low-level information on the Garbage Collector to advanced
concepts like creating applications that use Enterprise Services, creating
Web Services and even advanced Windows GUI. This book will become your
definitive source of information on C# programming and the .NET framework.
The
book's lay-flat design makes it an ideal desk reference and the online
searching and indexing through Safari make it the perfect tool for finding
information quickly. Microsoft Visual C# .NET 2003 Unleashed will show
you all the ways you can unleash your C# programming skills.
Related
Books
Teach Yourself Books (Teach
Yourself Books)
Table of Contents
Introduction
I. INTRODUCTION TO THE VISUAL STUDIO
.NET IDE.
1. The Visual Studio .NET IDE.
Window Management and Customization
Customized Interfaces with Visual
Studio .NET's "Developer Profiles"
Configuring Keyboard Shortcuts
Filtering the MSDN Help
Maximizing Your Viewable Area
Using Visual Studio .NET 2003's Dockable
Windows
Understanding Visual Studio .NET 2003's
Tool Windows
Working with Documents
Enhancing the Text Editor
Finding Help Where You Need It
Editing HTML
Editing XML
Editing Binary Files
Using External Tools
Defining Your Own Tools
Summary
Further Reading
II. LANGUAGE FUNDAMENTALS.
2. Introduction to C#.
Why Learn Yet Another Language?
Learning Common Types
Understanding Value Types
Understanding Reference Types
Reference Versus Value Types
What Is the Common Language Runtime?
Multiple Languages, One Runtime
Isolation
Platform Invoke
Code Access Security
The JIT Compiler
Code Execution
COM Interoperability
Rotor: Microsoft's Shared Source Common
Language Infrastructure
Take Out the Trash: Theory of Garbage
Collection
Reference Counting
Generations
Collection
Partial Collection
Nondeterministic Finalization
Using IDisposable to Create Well-Behaved
Objects
Introduction to the Base Class Library
The Canonical "Hello World" Example
Summary
Further Reading
3. Expressions and Control Structures.
Expressions and Control Structures
Basic Expressions
Legal Variable Names
Using C# Operators
Pre/Post Operators
Program Flow Control: Control Structures
The Program Execution Path
Conditional Statements
The if Control Structure
The if/else Control Structure Combination
Short Circuit Evaluation
Using the Ternary Operator
The switch Statement
Looping
The for Loop
Using the for Statement
The foreach Statement
The while Loop
The do..while Loop
Summary
Further Reading
4. Strings and Regular Expressions.
String Basics
Understanding the Immutability of
Strings
Applying Formatting to Strings
Using Escape Sequences
Locating Substrings
Adding Padding
Trimming Characters
Replacing Characters
Splitting Strings
Modifying Case
The StringBuilder
Appending Values
Using AppendFormat
Inserting Strings
Replacing Strings and Characters
Removing Substrings
Using Regular Expressions
Understanding Expression Syntax
How to Use Matching
Validating Data with Regular Expressions
Grouping Matches
Replacing Matched Strings
Summary
Further Reading
5. Arrays and Collections.
Using Arrays
Understanding Single-Dimensional and
Multidimensional Arrays
Explaining Jagged Arrays
Passing Arrays as Parameters
Collection Basics
Understanding the Basic Collection
Interfaces
Iterating Through Collections
Collections Provided by the Base Class
Libraries
Using an ArrayList
Using a Stack
Using a Hashtable
Using a BitArray
Using the Queue
Using a SortedList
Creating Custom Collections
Implementing the CollectionBase Class
Creating a AddressList Collection
Summary
Further Reading
6. Objects and Classes.
Objects and Classes
Class Attributes
Operations in Object-Oriented Design
and Programming
Classes
Objects
Object State Maintenance
Advanced Topics in Classes and Objects
Inheriting from Base Classes
Introduction to Polymorphism
Summary
Further Reading
7. File and Stream I/O and Object
Persistence.
File and Stream I/O
Understanding File and Stream I/O
Using Streams: FileStream, MemoryStream,
StringReader, and StringWriter
Using the FileSystemWatcher
Object Persistence
Serializing Objects
Extending Standard Serialization
Summary
Further Reading
8. XML Fundamentals.
Working with the DOM
Creating an XML Document
Working with XML Nodes, Elements,
and Attributes
Persisting the DOM
Using the XmlReader Classes
What Is an XmlReader?
Using the XmlTextReader
Using the XmlValidatingReader
Using the XmlNodeReader
Making Use of XmlConvert
Exploring XPath
Learning the Syntax
Filtering Nodes
Introduction to the XPathDocument
Introduction to XSLT
Transforming XML Documents
Serialization XML Style
Using Basic XML Serialization
Customizing XML Serialization
Summary
Further Reading
9. Multithreaded Programming.
Thread Basics
Understanding the Key Thread Properties
and Methods
Explaining the ThreadStart Delegate
Creating a Thread
Running a Thread
Terminating a Thread
Suspending a Thread
Creating a Pause by "Sleeping" a Thread
Joining a Thread
Synchronization
Understanding the Different Types
of Synchronization
Applying the lock Keyword
Raising Thread Events
Using the Mutex Class
Using the Monitor Class
Safeguarding Variables (Interlocked
Increment/Decrement)
Reading Without Waiting (ReaderWriterLock)
Using the Thread Pool for Asynchronous
Programming
Explaining the WaitCallback Delegate
Queuing a Work Item
Passing Data to Threads
Further Reading
10. Events and Delegates.
What Is a Delegate?
Types of Delegates
Delegates Inside
Combined Delegates
Events
Summary
Further Reading
11. Reflection and Code Attributes.
Working with Reflection
Introduction to Reflection
How Reflection Works
Discovering Type Information at Runtime
Using Code Attributes
Introduction to Code Attributes
Using Code Attributes
Creating Custom Attributes
Querying Custom Attributes
Summary
Further Reading
12. Assemblies and AppDomains.
Assemblies
Introduction to Assemblies
Assembly Building Blocks
Introducing the Assembly Manifest
Metadata
Inside the Assembly-MSIL Code
Assembly Resources
Creating Assemblies
Embedding Content and Resources in
Assemblies
Localization and Satellite Assemblies
Satellite Assemblies
AppDomains
Introduction to AppDomains
Programming with AppDomains
Putting It Together-A Real-World Example
Building Application Plug-Ins
Summary
13. COM and Windows Interoperability.
Using .NET Code to Interact with COM
Introduction to COM Interop
The Runtime Callable Wrapper
.NET to COM Marshalling
Code Interoperability Example: .NET
Code Invoking COM Code
COM to .NET
The COM Callable Wrapper
.NET Code Attributes for COM Interop
Programming
Marshalling Data from COM to .NET
Interop Programming Example: COM Code
Utilizing .NET Components
When to Use Interop
Primary Interop Assemblies
Overview of Primary Interop Assemblies
Working with PIAs
Producing and Deploying PIAs
Platform Invoke (P/Invoke)
Introduction to Platform Invoke
Consuming Unmanaged DLLs
Platform Invoke-Data Marshalling
Platform Invoke Sample-The Win32 API
When to Use Platform Invoke
Summary
Further Reading
14. High-Performance Programming.
Introduction to Garbage Collection
Garbage Collection Internals-Generations
Coding with the Garbage Collector
in Mind
Caveat: Nondeterministic Finalization
Versus Deconstruction
Memory and Class Management in the
Common Language Runtime
Boxing and Unboxing
Collections and Boxing
Using the StringBuilder Class
High-Performance Code: Best Practices
Using Exceptions
Chunky API Calls
Value Versus Reference Types
Tip: Using AddRange on Collections
Jagged Versus Rectangular Arrays
For Versus Foreach
Utilizing Asynchronous I/O
Summary
Further Reading
III. WINDOWS APPLICATIONS.
15. Introduction to Windows Forms.
Windows Forms Basics
Introducing the Main Method
Understanding the Forms Designer
Hello World
Creating an Application Using the
Windows Application Wizard
Setting the Properties
Compiling and Running the Application
Responding to a Button Click
Summary
Further Reading
16. Windows Forms User Interface
Controls.
Standard Windows Forms User Interface
Controls
Performing Actions with Controls
Storing and Changing Values with Controls
Maintaining Lists with Controls
User Controls
Summary
Further Reading
17. Creating Visually Compelling
Windows Forms Applications.
Visual Inheritance
Using Inherited Forms
WinForms Visual Inheritance in Action
Visual Inheritance Best Practices
Creating and Using Dynamic Context
Menus
Introduction to Contextual, Adaptive
User Interfaces
A Sample Dynamic Context Menu in Action
Drawing Custom List Elements
Using the DrawMode Property
Creating a Custom ListBox
Creating Custom Menu Items
Shaped Forms
Introduction to Shaped Forms
Creating a Sample Shaped Form
Summary
Further Reading
18. Consuming Web Services.
Adding Web References
Adding References in Visual Studio
.NET
Using WSDL.EXE
Supporting Dynamic URLs
Storing URLs in app.config
Storing URLs in Isolated Storage
Dynamic URLs via UDDI Consumption
Consuming Web Services Asynchronously
Multithreaded Service Consumption
Sample
Web Service Client Reliability
Testing for Network Connection
Handling Web Service Errors
Supporting Offline Actions
Summary
Further Reading
19. Smart Clients.
Smart Clients
Understanding the Smart Client
Deploying Smart Client Updates from
a Centralized Server
Make Use of Web Services for Smart
Client Back-End Support
Deciding Whether to Process on the
Server Side or Client Side for Efficiency
Make Use of Online and Offline Functionality
Summary
Further Reading
20. Deploying Windows Applications.
Installing .NET Applications
Understanding Assembly Deployment
Placing Assemblies in the Global Assembly
Cache
Private Installations
Web Installations
Deploying from a URL
Deploying Smart Client Applications
MSI/Project Installations
Creating an Installation Project
Summary
Further Reading
IV. WEB APPLICATIONS.
21. Introduction to Web Forms and
ASP.NET.
Understanding the Web Forms Designer
Creating an ASP.NET "Hello World"
Application
Basic Event Handling
Summary
Further Reading
22. Web UI Controls.
Server Controls
User Controls
Summary
Further Reading
23. State Management in ASP.NET.
Client-Side State Management
Understanding View State
Using Hidden Form Fields
Explaining Cookies
Understanding Query Strings
Passing Server Control Values Between
Forms
Server-Side State Management
Explaining Application State
Understanding Session State
Summary
Further Reading
24. Caching.
Caching
Introduction to ASP.NET Caching
OutputCache Directive
Using HttpCachePolicy
Using the Cache Object
Summary
Further Reading
25. Advanced ASP.NET.
Creating ASP.NET Applications in a
Web Farm
ViewState in a Web Farm
Session State Maintenance in a Web
Farm
Application State in a Web Farm
Web Farm Configuration and Deployment
Web
Farm Best Practices, Recommendations,
and Caveats
Localization and Globalization in
ASP.NET
Using Localized Resources
Displaying Localized Content
"Out of the Box" Localization Functionality
Creating Custom HttpModules
Understanding the ASP.NET Application
Events
Creating a Custom HttpModule
Creating Custom HttpHandlers
Building a Synchronous HttpHandler
Summary
Further Reading
26. Deploying ASP.NET Applications.
Manually Deploying an ASP.NET Application
Deploying via "Copy Project"
XCopy Deployment
When to XCopy
Automated Deployment
Creating a Setup Project
Deploying a Setup Project
Advanced ASP.NET Deployment
Web Farm Considerations
Firewalls, DMZs, Routers, and Security
Constraints
Hosted Environment Considerations
Summary
Further Reading
V. DATA ACCESS.
27. Using .NET Data Providers.
SQL Server Data Provider
Introduction to the SQL Server Data
Provider
Using the SqlConnection Class
Using Database Connection Strings
with a SqlConnection
The SqlCommand Class
The SqlDataReader Class
The SqlDataAdapter Class
Working with the OLEDB Data Provider
Overview of the OLEDB Data Provider
Using the OleDbConnection
Using the OleDbCommand
Using the OleDbDataReader
Using the OleDbDataAdapter
Additional Data Providers
The Oracle .NET Data Provider (ODP.NET)
The Microsoft .NET Data Provider for
Oracle
The .NET ODBC Data Provider
The mySQL .NET Data Provider
DataSet and DataAdapter Binding
DataSet Review
Associating a DataSet with a DataAdapter
Sample: Hooking Up a DataSet to a
Live Data Source
Summary
Further Reading
28. Creating a Custom ADO.NET Data
Provider.
Custom Data Providers
When to Create a Data Provider
Steps for Implementing a Custom Data
Provider
Sample Data Provider Scenario
Overview of the Remote Data Provider
Implementing IDataParameter and IDataParameterCollection
The IDataParameter Interface
The IDataParameterCollection Interface
The RDPParameter Class
The RDPParameterCollection Class
Implementing a Custom Connection
The IDbConnection Interface
The RDPConnection Class
Implementing a Custom Command
The IDbCommand Interface
The RDPCommand Class
Implementing a Custom DataReader
The IDataReader Interface
The RDPDataReader Class
Implementing a Custom DataAdapter
The IDbDataAdapter Interface
The RDPDataAdapter Class
Summary
29. Typed DataSets and XSD.
XML Schema Definition
Introduction to XSD
Primitive Data Types in XSD
Derived Data Types
Complex Data Types
Grouping Elements
Annotating XML Schemas
XML Schema Facets
Programming XML Schemas-The XmlSchema
Class
Structuring DataSets with Schema
Defining Tables and Columns Using
XML Schema
Defining DataSet Keys and Constraints
with XML Schema
Typed DataSets
Creating Typed DataSets in Visual
Studio .NET
Building Typed DataSets Using XSD.EXE
Using Typed DataSets
Annotating Typed DataSets
Summary
Further Reading
30. Windows Forms Data Binding.
Data Binding Overview
Introduction to Windows Forms Data
Binding
Simple Data Binding
Complex Data Binding
One-Way and Two-Way Data Binding
Data Binding Mechanics
The BindingContext Class
The CurrencyManager Class
The PropertyManager Class
Data Binding Samples
Simple Binding
Binding to a ComboBox
DataGrid Binding
Advanced Binding Samples
Header/Detail Forms
Cascading Header/Detail
Summary
31. Web Forms Data Binding.
Data Binding Overview
Introduction to Web Forms Data Binding
<%# %> Binding Syntax
Simple Data Binding
Complex Data Binding
The DataBind() Methods
Data Binding Mechanics
Container.DataItem
DataBinder.Eval
The ItemDataBound Event
Data Binding Samples
Simple Binding
Repeater Binding
DataList Binding
DataGrid Binding
Advanced Binding Samples
Header and Detail Forms
Cascading Header and Detail
Summary
Further Reading
VI. WEB SERVICES.
32. Introduction to Web Services.
Introduction to Web Services
Defining Web Services
Overview of SOAP
Overview of WSDL
Building Web Services
Hello World
Complex Serialization
Using Transactions with a Web Service
Maintaining State with a Web Service
Contract-First Programming with Web
Services
Review of Web Service Consumption
Creating a Client Proxy for a Web
Service
Making Synchronous Calls
Making Asynchronous Calls
Summary
Further Reading
33. Introduction to WSE 2.0.
Introduction to WSE 2.0
Overview of GXA
Evolution of WSE
TCP Messaging
SOAP over TCP
SoapSender and SoapReceiver
The SoapService Class
The SoapClient Class
Security
Introduction to WSE Security
UsernameTokens
X.509 Certificates
Signing Messages
Messaging with Attachments Using WSE
2.0
Introduction to DIME
Transferring Files Via WSE
Summary
Further Reading
VII. SECURE APPLICATIONS.
34. Code Access Security.
Introduction to CAS
Using Code Access Security Permissions
Code Access Permissions
Identity Permissions
Role-Based Security Permissions
CAS Administration
Modifying CAS Policy
Policy Administration Tools
Increasing Assembly Trust Levels
Adjust Zone Security
Evaluate Assembly
Creating a Deployment Package
Writing CAS-Aware Code
Using Imperative Security Syntax
Using Declarative Security Syntax
Blocking Unwanted Clients
Summary
Further Reading
35. Securing Sensitive Data.
Secret Key (Symmetric) Encryption
DESCryptoServiceProvider
RC2CryptoServiceProvider
RijndaelManaged
TripleDESCryptoServiceProvider
Using Hashes to Protect Data
MACTripleDES
SHA1Managed
MD5CryptoServiceProvider
Public Key Encryption and Signatures
DSACryptoServiceProvider
RSACryptoServiceProvider
Windows Data Protection API
Using DPAPI
Creating a DPAPI Wrapper
Protecting Data in .NET with DPAPI
Summary
36. Securing ASP.NET Web Applications.
User Security
Authenticating Users
Authorizing Users with Roles
Implementing IIdentity and IPrincipal
Data Security in ASP.NET Applications
Protecting Connection Strings and
Web.config Data
Protecting User Passwords
Deciding When to Use SSL
Data Security with ViewState Encryption
Summary
Further Reading
37. Licensing and Intellectual Property.
Licensing Overview
Licensing Defined
When to License and Protect
Types of Licensing and Verification
Implementing Custom Licensing
Introduction to the License Provider
and License Manager
Creating a License
Creating a License Provider
Building Licensed Controls
Licensed Web Controls Versus Windows
Forms Controls
Licensing Implementation Strategies
Deciding on a Licensing Deployment
Method
Deciding on a Licensing Verification
Method
Deciding on a License Purchase Method
Deciding on a Licensing Method
Protecting Your Intellectual Property
Protecting Intellectual Property by
Hiding Your Licensing Algorithm
Protecting Intellectual Property Through
Obfuscation
Protecting Intellectual Property with
Alternative Back-Ends
Summary
Further Reading
VIII. ENTERPRISE AND CONNECTED APPLICATIONS.
38. Interface Programming.
Interface Programming
Understanding the Interface
Declaring the Interface Implicitly
Declaring the Interface Explicitly
Mapping the Interface
Inheriting the Interface
Summary
Further Reading
39. Remoting.
Remoting Architecture
Introduction to Remoting
Explaining Application Domains
Understanding the Context
Choosing a Channel
Life and Death of the Remote Object
Building the Remoting Server Application
Building the Client
IIS and Remoting
Summary
Further Reading
40. COM+ Enterprise Services.
Overview of COM+
Transactions
JIT Activation in COM+
Object Pooling
Construction Strings
Role-Based Security
Queued Components
Events
Building COM+ Components
Transactions
Construction Strings
JIT Activation Sample
Object Pooling
Shared Properties
Security in COM+
Object and Security Contexts
Role-Based Security
Advanced COM+
Events
Queued Components
Summary
Further Reading
41. Enterprise Templates.
Enterprise Templates
Introducing the Enterprise Template
Static and Dynamic Content
Static Prototypes
Subproject Wizards
Custom Wizards
Policy Files
TDL Elements
Teaching by Example
Setting Up the Prerequisites
Laying Out the Template
Creating the Template Structure
Assigning a Policy to the Template
Making the Template
Making the Template Available to Users
Testing the Template
Summary
Further Reading
IX. DEBUGGING AND TESTING.
42. Debugging Your Applications.
The Visual Studio .NET Debugging Environment
Setting Up the Application for Debugging
Understanding Syntax and Error Messages
Understanding the Debugging Tool Windows
Navigating the Application
Setting and Using Breakpoints
Debugging with Visual Studio .NET
Debugging an Application
43. Monitoring Your Applications.
Debugging and Tracing Statements
Trace Listeners
Trace Switches
Custom Trace Listeners
Summary
44. Instrumenting Your Application.
Instrumenting Applications
Introduction to Instrumenting an Application
Methods of Instrumentation
Windows Event Log
Examining the Debug and Trace Classes
Windows Management Instrumentation
Enterprise Instrumentation Framework
Introducing the EIF
Enterprise Instrumentation Framework
Requirements
Elements of the EIF
Request Tracing
Configuring EIF
Summary
Further Reading
45. The Future of C#.
The Future of C#
Generics
Anonymous Methods
Nullable Types at Last
List Management with Iterators
Partial Types
Static Classes
Summary
Further Reading
Index. |