Contents
Foreword
Dedication
Acknowledgments
About This Book
Introduction
The C# Compiler and Other Resources
Chapter 1 - Object-Oriented Basics
What Is an Object?
Inheritance
Containment
Polymorphism and Virtual Functions
Encapsulation and Visibility
Chapter 2 - The .NET Runtime Environment
The Execution Environment
A Simpler Programming Model
Safety and Security
Powerful Tools Support
Deployment, Packaging, and Support
Metadata
Assemblies
Language Interop
Attributes
Chapter 3 - C# QuickStart and Developing in C#
Hello, Universe
Namespaces and Using
Namespaces and Assemblies
Basic Data Types
Classes, Structs, and Interfaces
Statements
Enums
Delegates and Events
Properties and Indexers
Attributes
Developing in C#
The Command-Line Compiler
Visual Studio.NET
Other Tools of Note
Chapter 4 - Exception Handling
What’s Wrong with Return Codes?
Trying and Catching
The Exception Hierarchy
Passing Exceptions on to the Caller
Caller Beware
Caller Confuse
Caller Inform
User-Defined Exception Classes
Finally
Efficiency and Overhead
Design Guidelines
Chapter 5 - Classes 101
A Simple Class
Member Functions
ref and out Parameters
Overloading
Chapter 6 - Base Classes and Inheritance
The Engineer Class
Simple Inheritance
Arrays of Engineers
Virtual Functions
Abstract Classes
Sealed Classes and Methods
Chapter 7 - Member Accessibility and Overloading
Class Accessibility
Using Internal on Members
internal protected
The Interaction of Class and Member Accessibility
Method Overloading
Method Hiding
Better Conversions
Variable-Length Parameter Lists
Chapter 8 - Other Class Details
Nested Classes
Other Nesting
Creation, Initialization, Destruction
Constructors
Initialization
Destructors
Managing Non-Memory Resources
IDisposable and the Using Statement
IDisposable and Longer-Lived Objects
Static Fields
Static Member Functions
Static Constructors
Constants
Read-Only Fields
Chapter 9 - Structs (Value Types)
A Point Struct
Boxing and Unboxing
Structs and Constructors
Design Guidelines
Immutable Classes
Chapter 10 - Interfaces
A Simple Example
Working with Interfaces
The as Operator
Interfaces and Inheritance
Design Guidelines
Multiple Implementation
Explicit Interface Implementation
Implementation Hiding
Interfaces Based on Interfaces
Interfaces and Structs
Chapter 11 - Versioning
A Versioning Example
Designed for Versioning
Designing for Versioning
Chapter 12 - Statements and Flow of Execution
Selection Statements
If
Switch
Iteration Statements
While
Do
For
Foreach
Jump Statements
Break
Continue
Goto
Return
Other Statements
lock
using
try/catch/finally
checked/unchecked
Chapter 13 - Variable Scoping and Definite Assignment
Definite Assignment
Definite Assignment and Arrays
Chapter 14 - Operators and Expressions
Operator Precedence
Built-In Operators
User-Defined Operators
Numeric Promotions
Arithmetic Operators
Unary Plus (+) over
Unary Minus (-) over
Bitwise Complement (~) over
Addition (+) over
Subtraction (-) over
Multiplication (*) over
Division (/) over
Remainder (%) over
Shift (<< and >>) over
Increment and Decrement (++ and --) over
Relational and Logical Operators
Logical Negation (!) over
Relational Operators over
Logical Operators over
Conditional Operator (?:)
Assignment Operators
Simple Assignment
Compound Assignment
Type Operators
typeof
is
as
Checked and Unchecked Expressions
Chapter 15 - Conversions
Numeric Types
Conversions and Member Lookup
Explicit Numeric Conversions
Checked Conversions
Conversions of Classes (Reference Types)
To the Base Class of an Object
To an Interface the Object Implements
To an Interface the Object Might Implement
From One Interface Type to Another
Conversions of Structs (Value Types)
Chapter 16 - Arrays
Array Initialization
Multidimensional and Jagged Arrays
Multidimensional Arrays
Jagged Arrays
Arrays of Reference Types
Array Conversions
The System.Array Type
Sorting and Searching
Reverse
Chapter 17 - Strings
Operations
String Encodings and Conversions
Converting Objects to Strings
An Example
String Interning
StringBuilder
Regular Expressions
‘Regular Expression Options
More Complex Parsing
Chapter 18 - Properties
Accessors
Properties and Inheritance
Use of Properties
Side Effects When Setting Values
Static Properties
Property Efficiency
Property Accessibility
Virtual Properties
Chapter 19 - Indexers and Enumerators
Indexing with an Integer Index
Indexing with a String Index
Indexing with Multiple Parameters
Enumerators and Foreach
Improving the Enumerator
Disposable Enumerators
GetEnumerator() Returns IEnumerator
GetEnumerator() Returns a Class that Implements IDisposable
GetEnumerator() Returns a Class that Doesn’t Implement IDisposable
Design Guidelines
Chapter 20 - Enumerations
A Line Style Enumeration
Enumeration Base Types
Initialization
Bit Flag Enums
Conversions
The System.Enum Type
Chapter 21 - Attributes
Using Attributes
A Few More Details
An Attribute of Your Own
Attribute Usage
Attribute Parameters
Reflecting on Attributes
Chapter 22 - Delegates
Using Delegates
Delegates to Instance Members
Multicasting
Delegates as Static Members
Delegates as Static Properties
Chapter 23 - Events
Add and Remove Functions
Custom Add and Remove
Chapter 24 - User-Defined Conversions
A Simple Example
Pre and Post Conversions
Conversions Between Structs
Classes and Pre and Post Conversions
Design Guidelines
Implicit Conversions Are Safe Conversions
Define the Conversion in the More Complex Type
One Conversion to and from a Hierarchy
Add Conversions Only as Needed
Conversions That Operate in Other Languages
How It Works
Conversion Lookup
Chapter 25 - Operator Overloading
Unary Operators
Binary Operators
An Example
Restrictions
Guidelines
A Complex Number Class
Chapter 26 - Other Language Details
The Main Function
Returning an Int Status
Command-Line Parameters
Multiple Mains
Preprocessing
Preprocessing Directives
Other Preprocessor Functions
Lexical Details
Identifiers
Literals
Comments
Chapter 27 - Making Friends with the .NET Frameworks
Things All Objects Will Do
ToString
Equals
Hashes and GetHashCode()
Design Guidelines
Value Type Guidelines
Reference Type Guidelines
Chapter 28 - System.Array and the Collection Classes
Sorting and Searching
Implementing IComparable
Using IComparer
IComparer as a Property
Overloading Relational Operators
Advanced Use of Hashes
Synchronized Collections
Case-Insensitive Collections
IClon]eable
Other Collections
Design Guidelines
Functions and Interfaces by Framework Class
Chapter 29 - Threading and Asynchronous Operations
Data Protection and Synchronization
A Slightly Broken Example
Protection Techniques
Access Reordering and Volatile
Use of Volatile
Threads
Joining
Waiting with WaitHandle
Thread-Local Storage
Asynchronous Calls
A Simple Example
Return Values
Waiting for Completion
Classes That Support Asynchronous Calls Directly
Design Guidelines
Chapter 30 - Execution-Time Code Generation
Loading Assemblies
Making It Dynamic
Custom Code Generation
Polynomial Evaluation
A Custom C# Class
A Fast Custom C# Class
A CodeDOM Implementation
A Reflection.Emit Implementation
Summary
Chapter 31 - Interop
Using COM Objects
Being Used by COM Objects
Calling Native DLL Functions
Pointers and Declarative Pinning
Structure Layout
Calling a Function with a Structure Parameter
Hooking Up to a Windows Callback
Design Guidelines
Chapter 32 - .NET Frameworks Overview
Numeric Formatting
Standard Format Strings
Custom Format Strings
Date and Time Formatting
Custom Object Formatting
Numeric Parsing
Using XML in C#
InputOutput
Binary
Text
XML
Reading and Writing Files
Traversing Directories
Starting Processes
Serialization
Custom Serialization
Reading Web Pages
Accessing Environment Settings
Chapter 33 - Windows Forms
Our Application
Getting Started
The Form Designer
Finding Directory Sizes
Calculating Sizes 414
Displaying the Directory Tree and Sizes
Setting the Directory
Tracking Our Progress
Chapter 34 - DiskDiff: More Sophistication
Populating on a Thread
Interrupting a Thread
A Cancel Button
Decorating the TreeView
Expand-o-Matic
Populate on Demand
Sorting the Files
Saving and Restoring
Controlling Serialization
Serialization Performance
Finer Control of Serialization
Chapter 35 - DiskDiff: Making It Useful
Comparing Directories
File Manipulation
File and Directory Operations
Delete
Delete Contents
View in Notepad and Launch
Updating the User Interface
A Bit of Refactoring
Cleaning Up for the Parents
Keyboard Accelerators
Most Recently Used List
Tooltips
Increased Accuracy
Switching to Use Cluster Size
Chapter 36 - Deeper into C#
C# Style
Naming
Encapsulation
Guidelines for the Library Author
CLS Compliance
Class Naming
Unsafe Context
XML Documentation
Compiler Support Tags
XML Documentation Tags
XML Include Files
Garbage Collection in the .NET Runtime
Allocation
Mark and Compact
Generations
Finalization
Controlling GC Behavior
Deeper Reflection
Listing All the Types in an Assembly
Finding Members
Invoking Functions
Optimizations
Chapter 37 - Defensive Programming
Conditional Methods
Debug and Trace Classes
Asserts
Debug and Trace Output
Using Switches to Control Debug and Trace
BooleanSwitch
TraceSwitch
User-Defined Switch
Chapter 38 - The Command Line Compiler
Simple Usage
Response Files
Default Response File
Command-Line Options
Chapter 39 - C# Compared to Other Languages
Differences Between C# and C/C++
A Managed Environment
.NET Objects
C# Statements
Attributes
Versioning
Code Organization
Missing C# Features
Differences Between C# and Java
Data Types
Extending the Type System
Classes
Interfaces
Properties and Indexers
Delegates and Events
Attributes
Statements
Differences Between C# and Visual Basic 6
Code Appearance
Data Types and Variables
Operators and Expressions
Classes, Types, Functions, and Interfaces
Control and Program Flow
Select Case
On Error
Missing Statements
Other .NET Languages
Chapter 40 - C# Resources and Futures
C# Resources
MSDN
GotDotNet
Csharpindex
C-Sharp Corner
DotNet Books
C# Futures
Index
Note:
Mindcracker Network accepts no liability for providing the customer with the hard copy of the book purchased. Mindcracker is not responsible for any dispute relating to the above. All eBooks listed in this section are in "PDF" Format. Contact authors@c-sharpcorner.com for further assistant.