澹山雜識[善本]:一卷

副标题:无

作   者:(宋)錢功撰

分类号:

ISBN:9780071588416

微信扫一扫,移动浏览光盘

简介

Summary: Publisher Summary 1 The Most Comprehensive C# Resource AvailableWith its support for Language-Integrated Query (LINQ), C# 3.0 has revolutionized C# programming, and bestselling author Herb Schildt has updated and expanded his classic programming reference to cover it. Using carefully crafted explanations, insider tips, and hundreds of examples, this book presents in-depth coverage of all aspects of C#, including its keywords, syntax, and core libraries. Of course, details on the new C# 3.0 features, such as LINQ, lambda expressions, implicitly typed variables, and anonymous types are included.Essential for every C# programmer, this comprehensive guide is written in the clear, crisp, uncompromising style that has made Herb the choice of millions worldwide. Whether you are a novice programmer or a seasoned pro, the answers to all of your C# questions can be found in this definitive resource.Coverage includes:Data types and operatorsControl statements Classes and objectsConstructors, destructors, and methodsInterfaces, arrays, enumerations, and structuresMethod and operator overloadingInheritance and virtual methodsReflection and runtime type IDException handling Delegates, properties, events, and indexersAttributes MultithreadingGenericsLINQ (Language-Integrated Query)Lambda expressionsAnonymous typesExtension methodsImplicitly typed variablesI/O, networking, and collectionsThe preprocessor and much, much more  

目录

Table Of Contents:
Special Thanks xxi
Preface xxiii

Part I The C# Language

The Creation of C# 3(8)

C#'s Family Tree 3(4)

C: The Beginning of the Modern Age of Programming 3(1)

The Creation of OOP and C++ 4(1)

The Internet and Java Emerge 4(1)

The Creation of C# 5(2)

The Evolution of C# 7(1)

How C# Relates to the .NET Framework 7(1)

What Is the .NET Framework? 8(1)

How the Common Language Runtime Works 8(1)

Managed vs. Unmanaged Code 9(2)

The Common Language Specification 9(2)

An Overview of C# 11(24)

Object-Oriented Programming 11(2)

Encapsulation 12(1)

Polymorphism 12(1)

Inheritance 13(1)

A First Simple Program 13(9)

Using csc.exe, the C# Command-Line Compiler 14(1)

Using the Visual Studio IDE 15(4)

The First Sample Program, Line by Line 19(3)

Handling Syntax Errors 22(1)

A Small Variation 22(1)

A Second Simple Program 23(2)

Another Data Type 25(1)

Two Control Statements 26(3)

The if Statement 27(1)

The for Loop 28(1)

Using Code Blocks 29(2)

Semicolons, Positioning, and Indentation 31(1)

The C# Keywords 32(1)

Identifiers 33(1)

The .NET Framework Class Library 34(1)

Data Types, Literals, and Variables 35(28)

Why Data Types Are Important 35(1)

C#'s Value Types 35(1)

Integers 36(2)

Floating-Point Types 38(2)

The decimal Type 40(1)

Characters 41(1)

The bool Type 42(1)

Some Output Options 43(3)

Literals 46(3)

Hexadecimal Literals 47(1)

Character Escape Sequences 47(1)

String Literals 48(1)

A Closer Look at Variables 49(3)

Initializing a Variable 50(1)

Dynamic Initialization 50(1)

Implicitly Typed Variables 51(1)

The Scope and Lifetime of Variables 52(3)

Type Conversion and Casting 55(4)

Automatic Conversions 55(1)

Casting Incompatible Types 56(3)

Type Conversion in Expressions 59(4)

Using Casts in Expressions 60(3)

Operators 63(22)

Arithmetic Operators 63(4)

Increment and Decrement 64(3)

Relational and Logical Operators 67(4)

Short-Circuit Logical Operators 70(1)

The Assignment Operator 71(2)

Compound Assignments 72(1)

The Bitwise Operators 73(9)

The Bitwise AND, OR, XOR, and NOT Operators 73(6)

The Shift Operators 79(2)

Bitwise Compound Assignments 81(1)

The? Operator 82(1)

Spacing and Parentheses 83(1)

Operator Precedence 84(1)

Program Control Statements 85(24)

The if Statement 85(3)

Nested ifs 86(1)

The if-else-if Ladder 87(1)

The switch Statement 88(4)

Nested switch Statements 92(1)

The for Loop 92(7)

Some Variations on the for Loop 94(5)

The while Loop 99(2)

The do-while Loop 101(1)

The foreach Loop 102(1)

Using break to Exit a Loop 102(2)

Using continue 104(1)

return 105(1)

The goto 105(4)

Introducing Classes and Objects 109(28)

Class Fundamentals 109(5)

The General Form of a Class 109(1)

Define a Class 110(4)

How Objects Are Created 114(1)

Reference Variables and Assignment 115(1)

Methods 116(10)

Add a Method to the Building Class 117(2)

Return from a Method 119(1)

Return a Value 120(2)

Use Parameters 122(3)

Add a Parameterized Method to Building 125(1)

Avoiding Unreachable Code 126(1)

Constructors 126(4)

Parameterized Constructors 128(1)

Add a Constructor to the Building Class 129(1)

The new Operator Revisited 130(1)

Using new with Value Types 130(1)

Garbage Collection and Destructors 131(2)

Destructors 131(2)

The this Keyword 133(4)

Arrays and Strings 137(28)

Arrays 137(4)

One-Dimensional Arrays 137(4)

Multidimensional Arrays 141(3)

Two-Dimensional Arrays 141(1)

Arrays of Three or More Dimensions 142(1)

Initializing Multidimensional Arrays 143(1)

Jagged Arrays 144(2)

Assigning Array References 146(2)

Using the Length Property 148(3)

Using Length with Jagged Arrays 150(1)

Implicitly Typed Arrays 151(1)

The foreach Loop 152(4)

Strings 156(9)

Constructing Strings 156(1)

Operating on Strings 157(3)

Arrays of Strings 160(1)

Strings Are Immutable 161(1)

Strings Can Be Used in switch Statements 162(3)

A Closer Look at Methods and Classes 165(48)

Controlling Access to Class Members 165(7)

C#'s Access Modifiers 165(2)

Applying Public and Private Access 167(1)

Controlling Access: A Case Study 168(4)

Pass References to Methods 172(4)

How Arguments Are Passed 174(2)

Use ref and out Parameters 176(6)

Use ref 177(1)

Use out 178(3)

Use ref and out on References 181(1)

Use a Variable Number of Arguments 182(3)

Return Objects 185(3)

Return an Array 187(1)

Method Overloading 188(6)

Overload Constructors 194(5)

Invoke an Overloaded Constructor Through this 197(2)

Object Initializers 199(1)

The Main() Method 200(2)

Return Values from Main() 200(1)

Pass Arguments to Main() 200(2)

Recursion 202(3)

Understanding static 205(6)

Static Constructors 210(1)

Static Classes 211(2)

Operator Overloading 213(32)

Operator Overloading Fundamentals 213(7)

Overloading Binary Operators 214(2)

Overloading Unary Operators 216(4)

Handling Operations on C# Built-in Types 220(4)

Overloading the Relational Operators 224(2)

Overloading true and false 226(3)

Overloading the Logical Operators 229(6)

A Simple Approach to Overloading the Logical Operators 229(2)

Enabling the Short-Circuit Operators 231(4)

Conversion Operators 235(4)

Operator Overloading Tips and Restrictions 239(1)

Another Example of Operator Overloading 240(5)

Indexers and Properties 245(24)

Indexers 245(9)

Creating One-Dimensional Indexers 245(4)

Indexers Can Be Overloaded 249(2)

Indexers Do Not Require an Underlying Array 251(1)

Multidimensional Indexers 252(2)

Properties 254(7)

Auto-Implemented Properties 259(1)

Use Object Initializers with Properties 260(1)

Property Restrictions 261(1)

Use Access Modifiers with Accessors 261(3)

Using Indexers and Properties 264(5)

Inheritance 269(42)

Inheritance Basics 269(3)

Member Access and Inheritance 272(4)

Using Protected Access 275(1)

Constructors and Inheritance 276(6)

Calling Base Class Constructors 278(4)

Inheritance and Name Hiding 282(3)

Using base to Access a Hidden Name 283(2)

Creating a Multilevel Hierarchy 285(3)

When Are Constructors Called? 288(1)

Base Class References and Derived Objects 289(5)

Virtual Methods and Overriding 294(7)

Why Overridden Methods? 297(1)

Applying Virtual Methods 298(3)

Using Abstract Classes 301(4)

Using sealed to Prevent Inheritance 305(1)

The object Class 305(6)

Boxing and Unboxing 307(2)

Is object a Universal Data Type? 309(2)

Interfaces, Structures, and Enumerations 311(26)

Interfaces 311(5)

Implementing Interfaces 312(4)

Using Interface References 316(2)

Interface Properties 318(2)

Interface Indexers 320(2)

Interfaces Can Be Inherited 322(1)

Name Hiding with Interface Inheritance 323(1)

Explicit Implementations 323(3)

Choosing Between an Interface and an Abstract Class 326(1)

The .NET Standard Interfaces 326(1)

Structures 326(6)

Why Structures? 330(2)

Enumerations 332(5)

Initialize an Enumeration 333(1)

Specify the Underlying Type of an Enumeration 334(1)

Use Enumerations 334(3)

Exception Handling 337(26)

The System.Exception Class 337(1)

Exception Handling Fundamentals 338(3)

Using try and catch 338(1)

A Simple Exception Example 338(2)

A Second Exception Example 340(1)

The Consequences of an Uncaught Exception 341(2)

Exceptions Let You Handle Errors Gracefully 343(1)

Using Multiple catch Clauses 344(1)

Catching All Exceptions 345(1)

Nesting try Blocks 346(1)

Throwing an Exception 347(2)

Rethrowing an Exception 348(1)

Using finally 349(2)

A Closer Look at the Exception Class 351(3)

Commonly Used Exceptions 352(2)

Deriving Exception Classes 354(4)

Catching Derived Class Exceptions 358(2)

Using checked and unchecked 360(3)

Using I/O 363(36)

C#'s I/O Is Built Upon Streams 363(1)

Byte Streams and Character Streams 363(1)

The Predefined Streams 363(1)

The Stream Classes 364(3)

The Stream Class 364(1)

The Byte Stream Classes 365(1)

The Character Stream Wrapper Classes 365(2)

Binary Streams 367(1)

Console I/O 367(4)

Reading Console Input 367(2)

Using ReadKey() 369(2)

Writing Console Output 371(1)

FileStream and Byte-Oriented File I/O 371(7)

Opening and Closing a File 372(2)

Reading Bytes from a FileStream 374(1)

Writing to a File 375(1)

Using FileStream to Copy a File 376(2)

Character-Based File I/O 378(3)

Using StreamWriter 378(2)

Using a StreamReader 380(1)

Redirecting the Standard Streams 381(2)

Reading and Writing Binary Data 383(7)

BinaryWriter 383(1)

BinaryReader 384(2)

Demonstrating Binary I/O 386(4)

Random Access Files 390(2)

Using MemoryStream 392(2)

Using StringReader and StringWriter 394(2)

Converting Numeric Strings to Their Internal Representation 396(3)

Delegates, Events, and Lambda Expressions 399(38)

Delegates 399(9)

Delegate Method Group Conversion 402(1)

Using Instance Methods as Delegates 402(2)

Multicasting 404(2)

Covariance and Contravariance 406(2)

System.Delegate 408(1)

Why Delegates 408(1)

Anonymous Functions 408(1)

Anonymous Methods 409(4)

Pass Arguments to an Anonymous Method 410(1)

Return a Value from an Anonymous Method 410(2)

Use Outer Variables with Anonymous Methods 412(1)

Lambda Expressions 413(6)

The Lambda Operator 413(1)

Expression Lambdas 414(2)

Statement Lambdas 416(3)

Events 419(10)

A Multicast Event Example 421(1)

Instance Methods vs. Static Methods as Event Handlers 422(2)

Using Event Accessors 424(5)

Miscellaneous Event Features 429(1)

Use Anonymous Methods and Lambda Expressions with Events 429(1)

.NET Event Guidelines 430(3)

Use EventHandler 432(1)

Applying Events: A Case Study 433(4)

Namespaces, the Preprocessor, and Assemblies 437(22)

Namespaces 437(14)

Declaring a Namespace 438(2)

Namespaces Prevent Name Conflicts 440(1)

using 441(2)

A Second Form of using 443(1)

Namespaces Are Additive 444(2)

Namespaces Can Be Nested 446(1)

The Global Namespace 447(1)

Using the :: Namespace Alias Qualifier 447(4)

The Preprocessor 451(6)

#define 452(1)

#if and #endif 452(2)

#else and #elif 454(1)

#undef 455(1)

#err or 456(1)

#warning 456(1)

#line 456(1)

#region and #endregion 456(1)

#pragma 457(1)

Assemblies and the internal Access Modifier 457(2)

The internal Access Modifier 458(1)

Runtime Type ID, Reflection, and Attributes 459(36)

Runtime Type Identification 459(4)

Testing a Type with is 459(1)

Using as 460(2)

Using typeof 462(1)

Reflection 463(2)

The Reflection Core: System.Type 463(2)

Using Reflection 465(18)

Obtaining Information About Methods 465(4)

Calling Methods Using Reflection 469(2)

Obtaining a Type's Constructors 471(4)

Obtaining Types from Assemblies 475(6)

Fully Automating Type Discovery 481(2)

Attributes 483(8)

Attribute Basics 483(4)

Positional vs. Named Parameters 487(4)

Three Built-in Attributes 491(4)

AttributeUsage 491(1)

The Conditional Attribute 491(2)

The Obsolete Attribute 493(2)

Generics 495(50)

What Are Generics? 495(1)

A Simple Generics Example 496(6)

Generic Types Differ Based on Their Type Arguments 499(1)

How Generics Improve Type Safety 499(3)

A Generic Class with Two Type Parameters 502(1)

The General Form of a Generic Class 503(1)

Constrained Types 503(19)

Using a Base Class Constraint 504(8)

Using an Interface Constraint 512(4)

Using the new() Constructor Constraint 516(1)

The Reference Type and Value Type Constraints 517(3)

Using a Constraint to Establish a Relationship Between Two Type Parameters 520(1)

Using Multiple Constraints 521(1)

Creating a Default Value of a Type Parameter 522(1)

Generic Structures 523(1)

Creating a Generic Method 524(3)

Using Explicit Type Arguments to Call a Generic Method 527(1)

Using a Constraint with a Generic Method 527(1)

Generic Delegates 527(3)

Generic Interfaces 530(4)

Comparing Instances of a Type Parameter 534(3)

Generic Class Hierarchies 537(3)

Using a Generic Base Class 537(2)

A Generic Derived Class 539(1)

Overriding Virtual Methods in a Generic Class 540(2)

Overloading Methods That Use Type Parameters 542(1)

How Generic Types Are Instantiated 543(1)

Some Generic Restrictions 544(1)

Final Thoughts on Generics 544(1)

Linq 545(40)

What Is LINQ? 545(1)

LINQ Fundamentals 546(5)

A Simple Query 546(2)

A Query Can Be Executed More Than Once 548(1)

How the Data Types in a Query Relate 549(1)

The General Form of a Query 550(1)

Filter Values with where 551(1)

Sort Results with orderby 552(4)

A Closer Look at select 556(4)

Use Nested from Clauses 560(1)

Group Results with group 561(2)

Use into to Create a Continuation 563(2)

Use let to Create a Variable in a Query 565(1)

Join Two Sequences with join 566(3)

Anonymous Types 569(2)

Create a Group Join 571(3)

The Query Methods 574(6)

The Basic Query Methods 574(1)

Create Queries by Using the Query Methods 575(2)

Query Syntax vs. Query Methods 577(1)

More Query-Related Extension Methods 577(3)

Deferred vs. Immediate Query Execution 580(1)

Expression Trees 581(1)

Extension Methods 582(3)

Unsafe Code, Pointers, Nullable Types, and Miscellaneous Topics 585(30)

Unsafe Code 585(13)

Pointer Basics 586(1)

Using unsafe 587(1)

Using fixed 588(1)

Accessing Structure Members Through a Pointer 589(1)

Pointer Arithmetic 589(2)

Pointer Comparisons 591(1)

Pointers and Arrays 591(2)

Pointers and Strings 593(1)

Multiple Indirection 594(1)

Arrays of Pointers 595(1)

stackalloc 596(1)

Creating Fixed-Size Buffers 596(2)

Nullable Types 598(5)

Nullable Basics 598(2)

Nullable Objects in Expressions 600(1)

The ?? Operator 601(1)

Nullable Objects and the Relational and Logical Operators 602(1)

Partial Types 603(1)

Partial Methods 604(1)

Friend Assemblies 605(1)

Miscellaneous Keywords 605(10)

lock 605(1)

readonly 606(1)

const and volatile 607(1)

The using Statement 607(1)

extern 608(7)

Part II Exploring the C# Library

Exploring the System Namespace 615(48)

The Members of System 615(2)

The Math Class 617(6)

The .NET Structures Corresponding to the Built-in Value Types 623(18)

The Integer Structures 623(3)

The Floating-Point Structures 626(4)

Decimal 630(4)

Char 634(6)

The Boolean Structure 640(1)

The Array Class 641(13)

Sorting and Searching Arrays 648(2)

Reversing an Array 650(1)

Copying an Array 651(1)

Using a Predicate 652(1)

Using an Action 653(1)

BitConverter 654(2)

Generating Random Numbers with Random 656(1)

Memory Management and the GC Class 657(2)

Object 659(1)

The IComparable and IComparableIT> Interfaces 659(1)

The IEquatableIT> Interface 660(1)

The IConvertible Interface 660(1)

The ICloneable Interface 660(2)

IFormatProvider and IFormattable 662(1)

Strings and Formatting 663(40)

Strings in C# 663(1)

The String Class 664(20)

The String Constructors 664(1)

The String Field, Indexer, and Property 665(1)

The String Operators 665(1)

The String Methods 665(16)

Padding and Trimming Strings 681(1)

Inserting, Removing, and Replacing 682(1)

Changing Case 683(1)

Using the Substring() Method 684(1)

The String Extension Methods 684(1)

Formatting 684(4)

Formatting Overview 685(1)

The Numeric Format Specifiers 686(1)

Understanding Argument Numbers 687(1)

Using String.Format() and ToString() to Format Data 688(4)

Using String.Format() to Format Values 688(3)

Using ToString() to Format Data 691(1)

Creating a Custom Numeric Format 692(3)

The Custom Format Placeholder Characters 692(3)

Formatting Date and Time 695(5)

Creating a Custom Date and Time Format 698(2)

Formatting Enumerations 700(3)

Multithreaded Programming 703(46)

Multithreading Fundamentals 703(1)

The Thread Class 704(6)

Creating and Starting a Thread 704(3)

Some Simple Improvements 707(1)

Creating Multiple Threads 708(2)

Determining When a Thread Ends 710(3)

Passing an Argument to a Thread 713(2)

The IsBackground Property 715(1)

Thread Priorities 715(2)

Synchronization 717(6)

An Alternative Approach 721(2)

The Monitor Class and lock 723(1)

Thread Communication Using Wait(), Pulse(), and PulseAll() 723(4)

An Example That Uses Wait() and Pulse() 724(3)

Deadlock and Race Conditions 727(1)

Using MethodImplAttribute 728(2)

Using a Mutex and a Semaphore 730(7)

The Mutex 730(4)

The Semaphore 734(3)

Using Events 737(2)

The Interlocked Class 739(2)

Terminating a Thread 741(4)

An Abort() Alternative 742(1)

Canceling Abort() 743(2)

Suspending and Resuming a Thread 745(1)

Determining a Thread's State 745(1)

Using the Main Thread 746(1)

Multithreading Tips 747(1)

Starting a Separate Task 747(2)

Collections, Enumerators, and Iterators 749(72)

Collections Overview 749(1)

The Non-Generic Collections 750(21)

The Non-Generic Interfaces 751(4)

The DictionaryEntry Structure 755(1)

The Non-Generic Collection Classes 755(16)

Storing Bits with BitArray 771(3)

The Specialized Collections 774(1)

The Generic Collections 774(25)

The Generic Interfaces 775(3)

The KeyValuePairITK, TV> Structure 778(1)

The Generic Collection Classes 779(20)

Storing User-Defined Classes in Collections 799(2)

Implementing IComparable 801(4)

Implementing IComparable for Non-Generic Collections 802(1)

Implementing IComparableιT> for Generic Collections 803(2)

Using an IComparer 805(3)

Using a Non-Generic IComparer 805(1)

Using a Generic IComparerI> 806(2)

Accessing a Collection via an Enumerator 808(3)

Using an Enumerator 808(1)

Using the IDictionaryEnumerator 809(2)

Implementing IEnumerable and IEnumerator 811(2)

Using Iterators 813(6)

Stopping an Iterator 815(1)

Using Multiple yield Directives 815(1)

Creating a Named Iterator 816(2)

Creating a Generic Iterator 818(1)

Collection Initializers 819(2)

Networking Through the Internet Using System.Net 821(26)

The System.Net Members 821(2)

Uniform Resource Identifiers 823(1)

Internet Access Fundamentals 823(7)

WebRequest 824(2)

WebResponse 826(1)

HttpWebRequest and HttpWebResponse 826(1)

A Simple First Example 827(3)

Handling Network Errors 830(3)

Exceptions Generated by Create() 830(1)

Exceptions Generated by GetReponse() 830(1)

Exceptions Generated by GetResponseStream() 831(1)

Using Exception Handling 831(2)

The Uri Class 833(1)

Accessing Additional HTTP Response Information 834(5)

Accessing the Header 834(2)

Accessing Cookies 836(2)

Using the LastModified Property 838(1)

MiniCrawler: A Case Study 839(3)

Using WebClient 842(5)

Use System.Windows.Forms to Create Form-Based Windows Applications 847(24)

A Brief History of Windows Programming 847(1)

Two Ways to Write a Form-Based Windows Application 848(1)

How Windows Interacts with the User 848(1)

Windows Forms 849(1)

The Form Class 849(1)

A Skeletal Form-Based Windows Program 849(3)

Compiling the Windows Skeleton 851(1)

Adding a Button 852(1)

Button Basics 852(1)

Adding a Button to a Form 852(1)

A Simple Button Example 853(1)

Handling Messages 853(3)

An Alternative Implementation 856(1)

Using a Message Box 856(3)

Adding a Menu 859(8)

Creating a Traditional-Style Main Menu 859(4)

Creating a New-Style Menu with MenuStrip 863(4)

A Documentation Comment Quick Reference 867(1)

The XML Comment Tags 867(1)

Compiling Documentation Comments 868(1)

An XML Documentation Example 869(2)
Index 871

已确认勘误

次印刷

页码 勘误内容 提交人 修订印次

澹山雜識[善本]:一卷
    • 名称
    • 类型
    • 大小

    光盘服务联系方式: 020-38250260    客服QQ:4006604884

    意见反馈

    14:15

    关闭

    云图客服:

    尊敬的用户,您好!您有任何提议或者建议都可以在此提出来,我们会谦虚地接受任何意见。

    或者您是想咨询:

    用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问

    Video Player
    ×
    Audio Player
    ×
    pdf Player
    ×
    Current View

    看过该图书的还喜欢

    some pictures

    解忧杂货店

    东野圭吾 (作者), 李盈春 (译者)

    loading icon