Home Page Icon
Home Page
Table of Contents for
Copyright
Close
Copyright
by Brad Merrill, Peter Drayton, Ben Albahari
C# Essentials, 2nd Edition
Preface
Audience
About This Book
C# Online
Conventions Used in This Book
How to Contact Us
Acknowledgments
Ben Albahari
Peter Drayton
Brad Merrill
1. Introduction
C# Language
Common Language Runtime
Framework Class Library
A First C# Program
2. C# Language Reference
Identifiers
Types
Type Instances
Example: Building and Using Types
Implicit and Explicit Conversions
Categories of Types
Value types
Reference types
Pointer types
Predefined Types
Integral types
Integral conversions
Floating-point types
Floating-point conversions
decimal type
decimal conversions
char type
char conversions
bool type
bool conversions
object type
string type
Types and Memory
Memory for value types
Memory for reference types
Value types and reference types side by side
Unified Type System
Simple types are value types
Value types expand the set of simple types
Boxing and unboxing value types
Variables
Definite Assignment
Default Values
Expressions and Operators
Operator Precedence
Arithmetic Overflow Check Operators
Statements
Expression Statements
Declaration Statements
Empty Statements
Selection Statements
if-else statement
switch statement
Loop Statements
while loops
do-while loops
for loops
foreach loops
jump Statements
break statement
continue statement
goto statement
return statement
throw statement
lock statement
using statement
Organizing Types
Files
Namespaces
Nesting namespaces
Using a type with its fully qualified name
using keyword
Aliasing types and namespaces
Global namespace
Inheritance
Class Conversions
as operator
is operator
Polymorphism
Virtual Function Members
Abstract Classes and Members
Sealed Methods and Sealed Classes
Hiding Inherited Members
Versioning Virtual Function Members
Access Modifiers
Restrictions on Access Modifiers
Classes and Structs
Differences Between Classes and Structs
Instance and Static Members
Fields
Constants
Versioning with constants
Properties
Indexers
Methods
Signatures
Passing arguments by value
ref modifier
out modifier
params modifier
Overloading methods
Operators
Implementing value equality
Logically paired operators
Custom implicit and explicit conversions
Three-state logic operators
Indirectly overloadable operators
Instance Constructors
Calling base class constructors
Field initialization order
Constructor access modifiers
Static Constructors
Base class constructor order
Static field initialization order
Nondeterminism of static constructor calls
Self-Referencing
this keyword
base keyword
Destructors and Finalizers
Nested Types
Interfaces
Defining an Interface
Implementing an Interface
Using an Interface
Extending an Interface
Explicit Interface Implementation
Reimplementing an Interface
Interface Conversions
Arrays
Multidimensional Arrays
Local and Field Array Declarations
Array Length and Rank
Bounds Checking
Array Conversions
Enums
Enum Operators
Enum Conversions
Delegates
Multicast Delegates
Delegates Compared with Function Pointers
Delegates Compared with Interfaces
Events
Defining a Delegate for an Event
Storing Data for an Event with EventArgs
Declaring and Firing an Event
Acting on an Event with Event Handlers
Event Accessors
try Statements and Exceptions
try Statement
Exceptions
catch
Omitting the exception variable
Omitting the catch expression
Specifying multiple catch clauses
finally
Key Properties of the System.Exception Class
Attributes
Attribute Classes
Named and Positional Parameters
Explicitly Specifying Attribute Targets
Specifying Multiple Attributes
Unsafe Code and Pointers
Pointer Types
Unsafe Code
The fixed Statement
Pointer to Member Operator
The stackalloc Keyword
void*
Pointers to Unmanaged Code
Preprocessor Directives
Preprocessor Directives
XML Documentation
C/C++-Style Comments
Documentation Comments
XML Documentation Files
Predefined XML Tags
User-Defined Tags
Type or Member Cross-References
3. Programming the.NET Framework
Common Types
Object Class
Creating FCL-friendly types
ICloneable Interface
IComparable Interface
IFormattable Interface
Math
Language Support for Math
Special Types and Operators
Math Class
Random Class
Strings
String Class
Immutability of Strings
String Interning
Formatting Strings
Indexing Strings
Encoding Strings
StringBuilder Class
Collections
Concrete Collection Classes
ArrayList class
BitArray class
Hashtable class
Queue class
SortedList class
Stack class
StringCollection class
Collection Interfaces
IEnumerable interface
IEnumerator interface
ICollection interface
IComparer interface
IList interface
IDictionary interface
IDictionaryEnumerator interface
IHashCodeProvider interface
Regular Expressions
Regex Class
Match and MatchCollection Classes
Group Class
Capture and CaptureCollection Classes
Using Regular Expressions
Input/Output
Streams and Backing Stores
Abstract Stream class
Concrete Stream-derived classes
Encapsulating raw streams
Abstract TextReader/TextWriter classes
StreamReader and StreamWriter classes
StringReader and StringWriter classes
Directories and Files
Networking
Network Programming Models
Generic Request/Response Architecture
HTTP-Specific Support
Adding New Protocol Handlers
Using TCP, UDP, and Sockets
Using DNS
Threading
Thread Synchronization
The lock statement
Pulse and Wait operations
Deadlocks
Atomic operations
Common Thread Types
Monitor Class
Enter and Exit methods
TryEnter methods
Wait methods
Pulse and PulseAll methods
Assemblies
Elements of an Assembly
Packaging
Deployment
Versioning
Type Resolution
Security Permissions
Reflection
Type Hierarchy
Types, members, and nested types
Assemblies and modules
AppDomains
Retrieving the Type for an Instance
Retrieving a Type Directly
Reflecting Over a Type Hierarchy
Late Binding to Types
Activation
Advanced Uses of Reflection
Creating New Types at Runtime
Custom Attributes
Language Support for Custom Attributes
Compiler Support for Custom Attributes
Runtime Support for Custom Attributes
Predefined Attributes
AttributeUsage attribute
Conditional attribute
Obsolete attribute
CLSCompliant attribute
Serializable attribute
NonSerialized attribute
Defining a New Custom Attribute
Retrieving a Custom Attribute at Runtime
Automatic Memory Management
The Garbage Collector
Optimization Techniques
Finalizers
Dispose and Close Methods
Interop with Native DLLs
Marshaling Common Types
Marshaling Classes and Structs
In and Out Marshaling
Callbacks from Unmanaged Code
Predefined Interop Support Attributes
DllImport attribute
StructLayout attribute
FieldOffset attribute
MarshalAs attribute
In attribute
Out attribute
Interop with COM
Binding COM and C# Objects
Exposing COM Objects to C#
Exposing C# Objects to COM
COM Mapping in C#
Common COM Interop Support Attributes
ComVisible attribute
DispId attribute
ProgId attribute
Guid attribute
InterfaceType attribute
ComRegisterFunction attribute
4. Framework Class Library Overview
Core Types
Text
Collections
Streams and I/O
Networking
Threading
Security
Reflection and Metadata
Assemblies
Serialization
Remoting
Web Services
Data Access
XML
Graphics
Rich Client Applications
Web-Based Applications
Globalization
Configuration
Advanced Component Services
Diagnostics and Debugging
Interoperating with Unmanaged Code
Compiler and Tool Support
Runtime Facilities
Native OS Facilities
Undocumented Types
5. Essential .NET Tools
A. C# Keywords
B. Regular Expressions
C. Format Specifiers
Picture Format Specifiers
DateTime Format Specifiers
D. Data Marshaling
E. Working with Assemblies
Building Shareable Assemblies
Building Modules
Linking Modules to Assemblies
Building with Your New Assemblies
Sharing Assemblies
Managing the Global Assembly Cache
Using nmake
F. Namespaces and Assemblies
Index
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
Prev
Previous Chapter
Colophon
C# Essentials, 2nd Edition
Ben Albahari
Peter Drayton
Brad Merrill
Editor
Nancy Kotary
Editor
John Osborn
Copyright © 2010 O’Reilly Media, Inc.
2013-04-01T04:32:55-07:00
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