Home Page Icon
Home Page
Table of Contents for
Cover
Close
Cover
by Donald Xie, Jesse Liberty
Programming C# 3.0, 5th Edition
A Note Regarding Supplemental Files
Preface
C# and .NET
About This Book
What You Need to Use This Book
How This Book Is Organized
The C# Language
Part II C# and Data
Part III Programming with C#
Part IV The CLR and the .NET Framework
Who This Book Is For
Conventions Used in This Book
Support
We’d Like to Hear from You
Using Code Examples
Safari® Books Online
Acknowledgments
From Jesse Liberty
From Donald Xie
Dedications
From Jesse Liberty
From Donald Xie
I. The C# Language
1. C# 3.0 and .NET 3.5
The Evolution of C#
The C# Language
A Tiny Bit of History
C# Features
The .NET Platform
2. Getting Started: “Hello World”
Classes, Objects, and Types
Methods
Comments
Console Applications
Namespaces
The Dot Operator (.)
The using Directive
Case Sensitivity
The static Keyword
Developing “Hello World”
Editing “Hello World”
Compiling and Running “Hello World”
Using the Visual Studio 2008 Debugger
3. C# Language Fundamentals
Types
The Built-In Types
Choosing a built-in type
Converting built-in types
Variables and Constants
Definite Assignment
Constants
Enumerations
Strings
Identifiers
Whitespace
Statements
Unconditional Branching Statements
Conditional Branching Statements
if...else statements
Nested if statements
switch statements: an alternative to nested ifs
Switch on string statements
Iteration Statements
The goto statement
The while loop
The do...while loop
The for loop
The foreach statement
The continue and break statements
Operators
The Assignment Operator (=)
Mathematical Operators
Simple arithmetical operators (+, −, *, /)
The modulus operator (%) to return remainders
Increment and Decrement Operators
Calculate and reassign operators
The prefix and postfix operators
Relational Operators
Use of Logical Operators with Conditionals
Operator Precedence
The Ternary Operator
Preprocessor Directives
Defining Identifiers
Undefining Identifiers
#if, #elif, #else, and #endif
4. Classes and Objects
Defining Classes
Access Modifiers
Method Arguments
Creating Objects
Constructors
Initializers
Object Initializer
The this Keyword
Using Static Members
Invoking Static Methods
Using Static Fields
Destroying Objects
Finalizers Versus Dispose
Implementing the Close( ) Method
The using Statement
Passing Parameters
Passing by Reference
Overcoming Definite Assignment with “out” Parameters
Overloading Methods and Constructors
Encapsulating Data with Properties
The get Accessor
The set Accessor
Property Access Modifiers
Automatic Properties
readonly Fields
5. Inheritance and Polymorphism
Specialization and Generalization
Inheritance
Implementing Inheritance
Polymorphism
Creating Polymorphic Types
Creating Polymorphic Methods
Calling Base Class Constructors
Controlling Access
Versioning with the new and override Keywords
Abstract Classes
Limitations of Abstract
Sealed Class
The Root of All Types: Object
Nesting Classes
6. Operator Overloading
Using the operator Keyword
Supporting Other .NET Languages
Creating Useful Operators
Logical Pairs
The Equality Operator
Conversion Operators
Putting Operators to Work
7. Structs
Defining Structs
Creating Structs
Structs As Value Types
8. Interfaces
Defining and Implementing an Interface
Implementing More Than One Interface
Extending Interfaces
Combining Interfaces
Polymorphism with Interfaces
Interface Versus Abstract Class
Overriding Interface Implementations
Explicit Interface Implementation
Selectively Exposing Interface Methods
Member Hiding
9. Arrays, Indexers, and Collections
Arrays
Declaring Arrays
Understanding Default Values
Accessing Array Elements
The foreach Statement
Initializing Array Elements
The params Keyword
Multidimensional Arrays
Rectangular arrays
Jagged arrays
Array Bounds
Array Conversions
Sorting Arrays
Indexers
Indexers and Assignment
Indexing on Other Values
Collection Interfaces
The IEnumerable<T> Interface
Constraints
List<T>
Implementing IComparable
Implementing IComparer
Queues
Stacks
Dictionaries
IDictionary<K,V>
10. Strings and Regular Expressions
Strings
Creating Strings
The ToString( ) Method
Manipulating Strings
Finding Substrings
Splitting Strings
Manipulating Dynamic Strings
Regular Expressions
Using Regular Expressions: Regex
Using Regex Match Collections
Using Regex Groups
Using CaptureCollection
11. Exceptions
Throwing and Catching Exceptions
The throw Statement
The catch Statement
Taking corrective action
Unwinding the call stack
Try/Catch Best Practices
The finally Statement
Exception Objects
12. Delegates and Events
Events
Events and Delegates
Indirect Invocation
Publish and Subscribe/Observer
The Publishing Class: Clock
Registering to Be Notified
Sequence of Events
The Danger with Delegates
The event Keyword
Anonymous Methods
Lambda Expressions
Callback Methods
II. C# and Data
13. Introducing LINQ
Defining and Executing a Query
Creating the Query
The from clause
Filtering
Projection (or select)
Deferred Query Evaluation
LINQ and C#
Joining
Ordering and the var Keyword
Grouping and the group Keyword
Anonymous Types
Implicitly Typed Local Variables
Extension Methods
Defining and Using Extension Methods
Extension Method Restrictions
Lambda Expressions in LINQ
14. Working with XML
XML Basics (A Quick Review)
Elements
XHTML
X Stands for eXtensible
Creating XML Documents
XML Elements
XML Attributes
Searching in XML with XPath
Searching for a Single Node
Searching Using Axes
Predicates
XPath Functions
Searching Using XPathNavigator
Using XPathNodeIterator
Using XPathExpression
XML Serialization
Customizing XML Serialization Using Attributes
Runtime XML Serialization Customization
15. Putting LINQ to Work
Getting Set Up
LINQ to SQL Fundamentals
Using Visual Studio LINQ to SQL Designer
Retrieving Data
Creating Properties for Each Table
A LINQ Query
Updating Data Using LINQ to SQL
Adding a Customer Record
Modifying a Customer Record
Deleting Relational Data
LINQ to XML
16. ADO.NET and Relational Databases
Relational Databases and SQL
Tables, Records, and Columns
Normalization
Declarative Referential Integrity
SQL
The ADO.NET Object Model
DataTables and DataColumns
DataRelations
Rows
Data Adapter
DBCommand and DBConnection
DataReader
Getting Started with ADO.NET
III. Programming with C#
17. Programming ASP.NET Applications
Web Forms Fundamentals
Web Forms Events
Postback versus nonpostback events
State
Web Forms Life Cycle
Creating a Web Form
Code-Behind Files
Adding Controls
Server Controls
Data Binding
Examining the Code
Adding Controls and Events
18. WPF Applications
WPF in a Very Small Nutshell
Creating a WPF Example
The Example Program
Building the Application
Grids and Stack Panels
Style and Animation
Defining listbox styles
Triggers and animations
Adding Data
Instantiating objects declaratively
Using the Data in the XAML
Defining the Listbox
The Complete XAML File
Event Handling (Finally!)
What Have You Learned, Dorothy?
19. Programming Windows Forms Applications
Creating the Application
Creating Event Handlers
Populating the TreeView Controls
TreeNode objects
Recursing through the subdirectories
Getting the files in the directory
Handling TreeView Events
Clicking the source TreeView
Expanding a directory
Clicking the target TreeView
Handling the Clear button event
Implementing the Copy Button Event
Getting the selected files
Sorting the list of selected files
Handling the Delete Button Event
IV. The CLR and the .NET Framework
20. Attributes and Reflection
Attributes
Types of Attributes
Attribute targets
Applying attributes
Custom Attributes
Declaring an attribute
Naming an attribute
Constructing an attribute
Using an attribute
Reflection
Viewing Metadata
Type Discovery
Reflecting on a Type
Finding all type members
Finding type methods
Finding particular type members
Late Binding
21. Threads and Synchronization
Threads
Starting Threads
Joining Threads
Blocking Threads with Sleep
Killing Threads
Synchronization
Using Interlocked
Using Locks
Using Monitors
Race Conditions and Deadlocks
Race Conditions
Deadlocks
22. Streams
Files and Directories
Working with Directories
Creating a DirectoryInfo Object
Working with Files
Modifying Files
Reading and Writing Data
Binary Files
Buffered Streams
Working with Text Files
Asynchronous I/O
Network I/O
Creating a Network Streaming Server
Creating a Streaming Network Client
Handling Multiple Connections
Asynchronous Network File Streaming
Web Streams
Serialization
Using a Formatter
Working with Serialization
Serializing the object
Deserializing the object
Handling Transient Data
Isolated Storage
23. Programming .NET and COM
Importing ActiveX Controls
Creating an ActiveX Control
Importing a Control in .NET
Importing a control
Manually importing the control
Adding the control to the form
P/Invoke
Pointers
C# Keywords
About the Authors
Colophon
Copyright
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
Programming C# 3.0, 5th Edition
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset