買這商品的人也買了...
-
$580$458 -
$680$537 -
$2,610$2,480 -
$1,029Fundamentals of Logic Design, 4/e
-
$980$774 -
$970Introduction to Algorithms, 2/e
-
$249$197 -
$880$695 -
$1,274Computer Architecture: A Quantitative Approach, 3/e(精裝本)
-
$560$504 -
$1,860$1,767 -
$620$558 -
$780$741 -
$780CMMI: Guidelines for Process Integration and Product Improvement (Harcover)
-
$420$378 -
$590$466 -
$1,710$1,625 -
$720$562 -
$780$616 -
$720$569 -
$290$261 -
$750$675 -
$750$593 -
$680$537 -
$480$480
相關主題
商品描述
Description:
Get the in-depth architectural information you need about the hottest OOP language for Microsoft® .NET—now updated for final release code.
Take a detailed look at the internal architecture of the groundbreaking C# language with this architectural reference. It’s fully updated with information about the Microsoft® .NET platform and Microsoft Visual Studio® .NET. It’s packed with sample code and demo applications to show you exactly how to develop with C#. You’ll explore this advanced language and its design parameters and construction to gain a complete understanding of how it works—and why it works that way. Topics covered include:
C# CLASS FUNDAMENTALS
• Building C# applications and libraries
• The .NET type system
• Classes and structs
• Methods, properties, arrays, indexers, and attributes
• Interfaces
WRITING CODE
• Expressions and operators
• Program flow control
• String handling and regular expressions
• File I/O with streams
• Error handling with exceptions
• Operator overloading and user-defined conversions
• Delegates and event handlers
• Documentation with XML
ADVANCED C#
• Numerical processing and the Math class
• Collections and object enumeration
• Multithreaded programming
• Querying metadata with reflection
• Deterministic finalization and the Dispose pattern
• Pinning and memory management
• Using COM from C# applications
• .NET components in unmanaged code
• Incorporating security
CD-ROM FEATURES:
• A fully searchable electronic copy of the book
• Sample code in C# (also available at www.microsoft.com/mspress/books/5861.asp)
Table of Contents:
Foreword | xix |
Introduction | xxiii |
PART 1 C# CLASS FUNDAMENTALS | |
1 Building C# Applications and Libraries | 3 |
"Hello, World"—The Command-Line Version | 4 |
Using the Command-Line Compiler | 4 |
"Hello, World" Code Walk-Through | 7 |
One-Stop Programming | 7 |
Namespaces | 8 |
Classes and Members | 10 |
The Main Method | 11 |
The System.Console.WriteLine Method | 11 |
Namespaces and the using Directive | 12 |
Skeleton Code | 13 |
Class Ambiguity | 14 |
"Hello, World"—The Visual Studio .NET Version | 15 |
Building and Running .NET Applications | 18 |
Inside "Hello, World" | 20 |
Working with Assemblies and Modules | 24 |
Assembly Overview | 25 |
Benefits of Assemblies | 26 |
Building Assemblies | 27 |
Creating Shared Assemblies | 32 |
Working with the Global Assembly Cache | 35 |
Summary | 37 |
2 The .NET Type System | 39 |
Everything Is an Object | 40 |
The Root of All Types: System.Object | 41 |
Value Types and Reference Types | 43 |
Value Types | 43 |
Reference Types | 44 |
Boxing and Unboxing | 45 |
Converting from Value Types to Reference Types | 45 |
Converting from Reference Types to Value Types | 46 |
More Boxing Examples | 48 |
Types and Aliases | 53 |
Casting Between Types | 54 |
CTS Benefits | 56 |
Language Interoperability | 57 |
Singly Rooted Object Hierarchy | 57 |
Type Safety | 58 |
Summary | 58 |
3 Classes and Structs | 59 |
Defining Classes | 59 |
Class Members | 60 |
Access Modifiers | 62 |
The Main Method | 63 |
Command-Line Arguments | 64 |
Returning Values from Main | 66 |
Multiple Main Methods | 67 |
Constructors | 68 |
Static Members and Instance Members | 71 |
Constructor Initializers | 73 |
Specifying Run-Time Information in a Constructor Initializer | 78 |
Constants vs. Read-Only Fields | 81 |
Constants | 81 |
Read-Only Fields | 83 |
Inheritance | 87 |
Multiple Interfaces | 90 |
Sealed Classes | 91 |
Defining Structs in C# | 92 |
Struct Usage | 92 |
Guidelines to Using Structs | 95 |
Summary | 97 |
4 Methods | 99 |
Value and Reference Parameters | 100 |
ref Method Parameters | 101 |
out Method Parameters | 105 |
Value and Reference Parameters (Again) | 109 |
Method Overloading | 113 |
Overloading Constructors | 115 |
Inheritance and Overloading | 118 |
Variable Method Parameters | 119 |
Virtual Methods | 122 |
Method Overriding | 123 |
Polymorphism | 124 |
new and virtual Methods | 131 |
Calling Virtual Methods from Constructors | 134 |
Static Methods | 136 |
Access to Class Members | 137 |
Static Constructors | 138 |
Summary | 140 |
5 Properties, Arrays, and Indexers | 141 |
Properties as Smart Fields | 142 |
Defining and Using Properties | 143 |
Inside Properties | 145 |
Inheriting Properties | 150 |
Advanced Use of Properties | 155 |
Arrays | 156 |
Declaring Arrays | 156 |
Single-Dimensional Array Example | 157 |
Multidimensional Arrays | 158 |
Querying for Rank | 160 |
Jagged Arrays | 162 |
Treating Objects Like Arrays by Using Indexers | 164 |
Defining Indexers | 165 |
Indexer Example | 165 |
Inside Indexers | 167 |
Design Guidelines | 169 |
Summary | 170 |
6 Attributes | 171 |
Introducing Attributes | 172 |
Defining Attributes | 173 |
Querying for Attributes | 177 |
Class Attributes | 177 |
Method Attributes | 180 |
Field Attributes | 182 |
Attribute Parameters | 184 |
Positional Parameters and Named Parameters | 184 |
Common Mistakes with Named Parameters | 186 |
Valid Attribute Parameter Types | 187 |
The AttributeUsage Attribute | 187 |
Defining an Attribute Target | 188 |
Single-Use and Multiuse Attributes | 190 |
Specifying Inheritance Attribute Rules | 191 |
Attribute Identifiers | 193 |
Predefined Attributes | 195 |
Conditional Attribute | 197 |
Obsolete Attribute | 199 |
CLSCompliant Attribute | 200 |
DllImport and StructLayout Attributes | 201 |
Assembly Attributes | 203 |
Context Attributes | 205 |
Summary | 212 |
7 Interfaces | 213 |
Interface Use | 214 |
Declaring Interfaces | 215 |
Implementing Interfaces | 217 |
Querying for Implementation by Using is | 219 |
Querying for Implementation by Using as | 224 |
Interfaces vs. the Alternatives | 227 |
Explicit Interface Member Name Qualification | 230 |
Name Hiding with Interfaces | 230 |
Avoiding Name Ambiguity | 233 |
Interfaces and Inheritance | 238 |
Combining Interfaces | 242 |
Summary | 245 |
PART II WRITING CODE | |
8 Expressions and Operators | 249 |
Operators Defined | 249 |
Operator Precedence | 250 |
How C# Determines Precedence | 251 |
Left and Right Associativity | 252 |
Practical Usage | 253 |
C# Operators | 253 |
Primary Expression Operators | 253 |
Mathematical Operators | 259 |
Numeric Conversions | 269 |
checked and unchecked Context | 271 |
Bitwise Operators | 272 |
Relational Operators | 276 |
Simple Assignment Operators | 278 |
The Conditional Operator | 282 |
Summary | 284 |
9 Program Flow Control | 285 |
Selection Statements | 285 |
The if Statement | 285 |
The switch Statement | 292 |
Iteration Statements | 301 |
The while Statement | 301 |
The do/while Statement | 302 |
The for Statement | 305 |
The foreach Statement | 310 |
Branching with Jump Statements | 313 |
The break Statement | 313 |
The continue Statement | 317 |
The Infamous goto Statement | 319 |
The return Statement | 326 |
Summary | 327 |
10 String Handling and Regular Expressions | 329 |
Strings | 330 |
String Formatting | 333 |
Format Specifiers | 334 |
Objects and ToString | 338 |
Numeric String Parsing | 339 |
Strings and DateTime | 341 |
Encoding Strings | 345 |
The StringBuilder Class | 346 |
Splitting Strings | 347 |
Extending Strings | 348 |
String Interning | 350 |
Regular Expressions | 353 |
Match and MatchCollection | 358 |
Groups and Captures | 361 |
String-Modifying Expressions | 363 |
Regular Expression Options | 367 |
Compiling Regular Expressions | 368 |
Summary | 372 |
11 File I/O with Streams | 373 |
Stream Classes | 373 |
FileStream | 375 |
StreamReader and StreamWriter | 379 |
Memory and Buffered Streams | 381 |
String Readers and Writers | 384 |
Binary Readers and Writers | 387 |
File System Classes | 389 |
Directory and DirectoryInfo | 389 |
File and FileInfo | 392 |
Parsing Paths | 394 |
Nonconsole Use of Streams | 395 |
Windows OpenFileDialog | 395 |
Reading Web Pages | 397 |
Serialization | 399 |
Serializing with BinaryFormatter | 399 |
Serializing with SoapFormatter | 403 |
Serializing with XmlSerializer | 404 |
Implementing Iserializable | 406 |
Summary | 409 |
12 Error Handling with Exceptions | 411 |
Overview of Exception Handling | 411 |
Basic Exception-Handling Syntax | 413 |
Throwing an Exception | 413 |
Catching an Exception | 414 |
Rethrowing an Exception | 418 |
Cleaning Up with finally | 420 |
Retrying Code | 424 |
Comparing Error-Handling Techniques | 426 |
Benefits of Exception Handling Over Return Codes | 427 |
Handling Errors in the Correct Context | 429 |
Improving Code Readability | 430 |
Throwing Exceptions from Constructors | 432 |
Using the System.Exception Class | 432 |
Constructing an Exception Object | 432 |
Using the StackTrace Property | 436 |
Catching Multiple Exception Types | 437 |
Deriving Your Own Exception Classes | 438 |
Designing Your Code with Exception Handling | 441 |
Design Issues with the try Block | 441 |
Design Issues with the catch Block | 445 |
Summary | 448 |
13 Operator Overloading and User-Defined Conversions | 449 |
Operator Overloading | 450 |
Operator Overloading Syntax | 450 |
Operator Overloading Rules and Restrictions | 451 |
Operator Overloading Examples | 453 |
RGB Color Incrementing Example | 456 |
Operator Overloading Design Guidelines | 462 |
User-Defined Conversions | 464 |
User-Defined Conversion Syntax | 465 |
User-Defined Conversion Rules and Restrictions | 465 |
User-Defined Conversion Examples | 465 |
Summary | 479 |
14 Delegates and Event Handlers | 481 |
Using Delegates as Callback Methods | 481 |
Inside Delegates | 485 |
Defining Delegates as Static Members | 489 |
Creating Delegates Only When Needed | 492 |
Multicast Delegates | 495 |
Multicast Delegate Justification | 501 |
Defining Events with Multicast Delegates | 504 |
Summary | 509 |
15 Documentation with XML | 511 |
Getting Started | 511 |
Adding Elements | 514 |
Acceptable Code Constructs | 514 |
Compiler-Generated Element IDs | 515 |
Fields, Properties, Events, and Indexers | 516 |
Methods | 518 |
Well-Formed XML | 523 |
Comment Web Pages | 525 |
Element Tags and Attributes | 526 |
The <exception> Tag and cref Attribute | 528 |
The <c>, <code>, and <example> Tags | 529 |
The <include> Tag | 530 |
The <list> Tag | 533 |
Custom Formatting | 534 |
XML and Data | 537 |
Summary | 539 |
ADVANCED C# | |
16 Numerical Processing and the Math Class | 543 |
Numeric Support in C# and .NET | 543 |
Is the Decimal Type a Primitive? | 545 |
Numeric Suffixes | 547 |
A Numeric Type by Any Other Name. | 547 |
More on Numeric Literals | 549 |
Integral Ranges and Overflow Rules | 552 |
The Decimal Type | 557 |
The System.Math Class | 558 |
System.Math Constants | 558 |
Working with a Number's Sign | 558 |
Minimum and Maximum Values | 559 |
Methods for Rounding and Truncating | 560 |
Summary | 560 |
17 Collections and Object Enumeration | 563 |
Implementing the Enumeration Interface | 563 |
Using an Enumerator Object | 568 |
Using the foreach Statement with Collections | 569 |
Two Interfaces for the Price of One | 571 |
Constructing Enumerator Objects | 572 |
Creating
類似商品
|