Deep understanding of C # (2nd edition) pdf

Source: Internet
Author: User



: Network Disk Download








Content Introduction· · · · · ·


"In-depth understanding of C # (2nd edition)" is a rare classic in C # field. The author, Jon Skeet, is more focused on discovering the essence of the phenomenon while at the same time presenting the various knowledge points of C # in detail. This book explores the core concepts and classic features of C # and incorporates them into the code, allowing readers to truly appreciate the "deep" and "subtle" aspects of C #. Based on the 1th edition, new features of C # 4, such as dynamic types, named arguments, and optional parameters, have been added to the book to elevate the C # language to a new level.



The in-depth understanding of C # (2nd edition) is suitable for advanced. NET developers to read.


Author profile ...


Jon Skeet Google software engineer, Microsoft Senior C # MVP, has nearly 10 years of experience in C # project development. He is a very active technical expert in the C # community and newsgroups, answering tens of thousands of C # and. NET related issues. He also writes articles on his personal web site, explaining the most difficult questions that C # and. NET understand. He also has another bestseller, Groovy in Action.


Catalogue ... the first part of the basics
1th Evolutionary History of C # development 2
1.1 Starting with simple data types 3
1.1.1 Product types defined in C # 1 3
1.1.2 Strongly-typed collections in C # 2 4
1.1.3 Auto-implemented properties in C # 3 5
1.1.4 named argument 6 in C # 4
1.2 Sorting and Filtering 7
1.2.1 Sorting products by name 7
1.2.2 Query Collection 10
1.3 Dealing with unknown data 11
1.3.1 represents an unknown price of 12
1.3.2 Optional parameters and default values 12
1.4 Introduction to LINQ 13
1.4.1 query expressions and in-process queries 13
1.4.2 Query XML 14
1.4.3 LINQ to SQL 15
1.5 COM and dynamic type 16
1.5.1 Simplifying COM Interop 16
1.5.2 and dynamic Language interoperability 17
1.6 Anatomy of the. NET Platform 18
1.6.1 C # language 18
1.6.2 Run-time 19
1.6.3 Framework Library 19
1.7 How to write an ultra-flashy code 19
1.7.1 full code 20 in the form of code snippets
1.7.2 Teaching code is not product code 21
1.7.3 your new friend: Language Specification 21
1.8 Summary 21
2nd 1 Core Fundamentals of C # 23
2.1 Delegate 23
2.1.1 Composition of simple delegates 24
2.1.2 Merging and deleting delegates 28
2.1.3 Simple discussion of events 29
2.1.4 Commission Summary 30
2.2 Characteristics of the type system 31
2.2.1 Location of C # in the world of type systems 31
2.2.2 C # 1 type system when is not enough 34
2.2.3 Type System Features summary 36
2.3 Value types and reference types 36
2.3.1 values and references in the real world 36
2.3.2 value types and reference types Basics 37
2.3.3 out of the wrong 38
2.3.4 Packing and Unpacking 40
2.3.5 value types and reference types summary 41
2.4 C # 1: New features built on a solid foundation 41
2.4.1 Properties related to delegates 41
2.4.2 features related to the type System 43
2.4.3 Properties related to value types 45
2.5 Summary 46
Part Two C # 2: Solving problems with C # 1
The 3rd chapter uses the generic type to realize the parameterized type 48
3.1 Why generics are required 49
3.2 Simple generics for daily use 50
3.2.1 Learning by Example: generic dictionary 50
3.2.2 generic type and type parameter 52
3.2.3 generic method and interpretation generic declaration 55
3.3 Deepening and increasing 58
3.3.1 Type constraint 58
3.3.2 type inference for generic method type arguments 62
3.3.3 Implementing generics 63
3.4 High-level generics 68
3.4.1 static fields and static constructors 69
3.4.2 How the JIT compiler handles generics 70
3.4.3 Generic Iteration 72
3.4.4 Reflection and Generics 74
3.5 Limitations of Generics in C # and other languages 78
3.5.1 lack of generic variability 78
3.5.2 lack of operator constraints or "numeric" constraints 82
3.5.3 lack of generic properties, indexers, and other member types 83
3.5.4 vs. C + + templates 84
Comparison of 3.5.5 and Java generics 85
3.6 Summary 86
Chapter 4th Nullable Type 88
4.1 What to do if there is no value 88
4.1.1 Why a variable of value type cannot be NULL 89
4.1.2 Mode 89 for null values in C # 1
4.2 System.nullable<t> and System.Nullable 91
4.2.1 Nullable<t> Introduction 91
4.2.2 Nullable<t> packing and unpacking 94
4.2.3 Equality of Nullable<t> instances 95
4.2.4 support from non-generic nullable classes 96
4.3 C # 2 provides syntactic sugars for nullable types 96
4.3.1? modifier 97
4.3.2 using NULL for assignment and comparison 98
4.3.3 Nullable conversion and operator 99
4.3.4 Nullable Logic 102
4.3.5 using the AS operator 103 for nullable types
4.3.6 Empty Merge operator 104
4.4 Novelty usage of nullable types 106
4.4.1 attempting an operation that does not use an output parameter 107
4.4.2 Empty merge operator makes comparisons no longer painful 108
4.5 Summary 111
5th. Commission to enter the fast track 112
5.1 Say goodbye to clumsy delegate grammar 113
5.2 Method Group Conversion 114
5.3 Covariance and inverse degeneration 115
5.3.1 inverse of the delegate parameter 116
Covariance of 5.3.2 delegate return type 117
5.3.3 risk of incompatibility 118
5.4 Inline delegate operations with anonymous methods 119
5.4.1 from a simple start: handling a parameter 119
5.4.2 The return value of the anonymous method 121
5.4.3 Ignore delegate parameter 123
5.5 Capturing a variable in an anonymous method 124
5.5.1 defining closures and different types of variables 124
5.5.2 testing the behavior of a captured variable 126
5.5.3 What is the use of capturing variables 127
5.5.4 the extended lifetime of the capture variable 127
5.5.5 local variable instantiation 128
5.5.6 shared and unshared variables mixed use 130
5.5.7 usage rules and summary of capture variables 132
5.6 Summary 133
6th. The shortest way to implement an iterator 134
6.1 C # 1: The pain of a handwriting iterator 135
6.2 C # 2: Simplifying iterators with yield statements 137
Introduction to 6.2.1 iterator block and yield return 137
6.2.2 observing the workflow of Iterators 139
6.2.3 further understanding of the iterator execution process 141
6.2.4 in the specific implementation of the peculiar place 144
6.3 Real Example: Iteration Range value 145
6.3.1 Iteration Schedule Date 145
6.3.2 Line 146 in an iteration file
6.3.3 delay filtering of items using iterator blocks and predicates 148
6.4 Using CCR to implement pseudo-sync code 150
6.5 Summary 152
The 7th chapter ends the explanation of C # 2: Some final features 153
7.1 Partial Type 154
7.1.1 Creating a type in multiple files 154
7.1.2 use of partial types 156
7.1.3 C # 3 Exclusive partial method 157
7.2 Static Type 159
7.3 Independent method of accessor/assignment method property accessor 161
7.4 Namespace Aliases 162
7.4.1 Delimited namespace Aliases 163
7.4.2 Global Namespace alias 164
7.4.3 External Aliases 164
7.5 Pragma Directive 166
7.5.1 warning Pragma 166
7.5.2 checksum pragma 167
7.6 Fixed-size buffers in non-secure code 167
7.7 Exposing internal members to the selected assembly 169
7.7.1 in simple case friend Assembly 169
7.7.2 Why use InternalsVisibleTo 170
7.7.3 InternalsVisibleTo and signing Assembly 170
7.8 Summary 171
Part III C # 3: Innovating how to write code
The 8th chapter uses the intelligent compiler to prevent the error 174
8.1 Auto-implemented Properties 175
8.2 Implicitly-typed local variables 176
8.2.1 declaring a local variable with VAR 177
8.2.2 Implicit type restriction 178
8.2.3 implicit type advantages and disadvantages 179
8.2.4 recommendation 180
8.3 Simplified Initialization 180
8.3.1 Defining example Types 181
8.3.2 Setting simple Properties 182
8.3.3 setting properties for embedded objects 183
8.3.4 Collection Initialization List 184
Application of 8.3.5 initialization features 186
8.4 Implicitly-typed arrays 187
8.5 Anonymous Type 188
8.5.1 First Encounter anonymous type 188
8.5.2 members of anonymous types 190
8.5.3 Projection Initialization list 191
8.5.4 Key points 192
8.6 Summary 193
9th Lambda expression and expression tree 194
9.1 Lambda expression as a delegate 195
9.1.1 Preparatory work:func< > Delegate type Introduction 195
9.1.2 converted to lambda expression for the first time 196
9.1.3 using a single expression as the body 197
9.1.4 parameter list of implicit type 197
9.1.5 shortcut syntax for single parameters 198
9.2 Simple examples of using list<t> and events 199
9.2.1 filter, sort, and set other actions on a list 199
9.2.2 logging in an event handler 201
9.3 Expression Tree 202
9.3.1 Building an expression tree in a program 202
9.3.2 compiling an expression tree into a delegate 204
9.3.3 Converting a C # Lambda expression to an expression tree 205
9.3.4 in the LINQ core expression tree 208
9.3.5 expression tree outside of LINQ 209
9.4 type inference and changes in overload resolution 211
9.4.1 cause of change: thin generic method call 211
9.4.2 infer the return type of an anonymous function 212
9.4.3 type inference in two phases 213
9.4.4 choosing the correct overloaded method 217
9.4.5 type inference and overload resolution 218
9.5 Summary 219
10th Chapter Extension Method 220
10.1 State before extension method was introduced 221
10.2 Syntax for extension methods 223
10.2.1 Declaration Extension Method 223
10.2.2 Calling extension method 224
How the 10.2.3 extension method was discovered 225
10.2.4 calling method 226 on a null reference
10.3. NET 3.5 Extension Methods 227
10.3.1 starting from Enumerable 228
10.3.2 use where to filter and link method calls together 229
10.3.3 episode: Déjà Vu in where method 231
10.3.4 projection with the Select method and anonymous type 232
10.3.5 Sort by order by method 232
10.3.6 practical examples of links 234
10.4 Use ideas and principles 235
10.4.1 "Expanding the world" and making interfaces richer 235
10.4.2 Smooth Interface 236
10.4.3 Rational Use of extension method 237
10.5 Summary 238
11th. query expressions and LINQ to Objects 240
11.1 LINQ Introduction 241
11.1.1 Basic Concepts in LINQ 241
11.1.2 defining the sample Data Model 245
11.2 Simple Start: SELECT element 246
11.2.1 begins with a data source to select as the end 246
11.2.2 compiler conversions as a basis for query expressions 247
11.2.3 range variables and important projections 249
11.2.4 Cast, OfType, and explicit type range variables 251
11.3 Filtering and sorting sequences 252
11.3.1 filtering using the WHERE clause 253
11.3.2 Degraded query Expression 253
11.3.3 using the ORDER BY clause 254
11.4 Let clause and transparent identifier 256
11.4.1 using let to perform intermediate calculations 256
11.4.2 Transparent identifier 257
11.5 Mating 258
11.5.1 inner joins using the join clause 258
11.5.2 grouping joins using the join INTO clause 262
11.5.3 using multiple from clauses for cross joins and merging sequences 264
11.6 Grouping and Continuation 267
11.6.1 grouping by using the GROUP BY clause 267
11.6.2 Query Continuation 270
11.7 make a selection between the query expression and the point marker 272
11.7.1 need to use dot-tagged actions 273
11.7.2 Select Point Marker 273
11.7.3 Selecting a query expression 274
11.8 Summary 275
12th. Linq Beyond the Set 276
12.1 Querying the database using LINQ to SQL 277
12.1.1 Databases and Models 277
12.1.2 Accessing a database with a query expression 279
12.1.3 a query that contains joins 281
12.2 Conversion with IQueryable and Iqueryprovider 283
Introduction to 12.2.1 iqueryable<t> and related interfaces 283
12.2.2 analog interface implementation to record call 285
12.2.3 to glue the expression together: queryable extension method 287
12.2.4 simulating the actual running query provider 289
12.2.5 Packaging IQueryable 290
12.3 LINQ-friendly APIs and LINQ to XML 290
12.3.1 core types in LINQ to XML 290
12.3.2 Declarative Construction 292
12.3.3 querying a single node 294
12.3.4 Merging query Operators 296
12.3.5 and LINQ coexist harmoniously 297
12.4 using parallel LINQ instead of LINQ to Objects 297
12.4.1 drawing Mandeborot set in a single thread 297
12.4.2 parallelenumerable, Parallel-query and AsParallel 299
12.4.3 Adjusting parallel Queries 300
12.5 Reversing the query model using LINQ to Rx 301
12.5.1 iobservable<t> and Iobserver<t> 302
12.5.2 simply begins 303
12.5.3 Querying observable objects 304
What is the meaning of 12.5.4 306
12.6 Extending LINQ to Objects 306
12.6.1 Design and Implementation Guide 307
12.6.2 example extension: Selecting a random element 308
12.7 Summary 309
Part IV C # 4: Good interactivity
13th minor changes to simplify your code 312
13.1 Optional parameters and named arguments 312
13.1.1 Optional Parameter 313
13.1.2 named argument 317
13.1.3 combination of the two 321
13.2 Improving COM Interoperability 324
13.2.1 manipulating Word before C # 4 is very scary 325
13.2.2 Optional parameters and named arguments for revenge 325
13.2.3 passing ref parameter 326 by value
13.2.4 calling a named indexer 327
13.2.5 Link Primary Interop Assemblies 328
13.3 generic variability of interfaces and delegates 330
Types of 13.3.1 variability: covariance and Contravariance 331
13.3.2 using the variability 332 in an interface
13.3.3 using variability 334 in delegates
13.3.4 Complex Situation 335
13.3.5 Limitations and Descriptions 336
13.4 minor changes to lock and field style events 339
13.4.1 Robust Lock 339
13.4.2 field-style event 340
13.5 Summary 341
Chapter 14th dynamic Binding in static languages 342
14.1 What is, when, why, how 343
14.1.1 What is dynamic type 343
14.1.2 dynamic type When it's useful, why 344
14.1.3 C # 4 How to provide dynamic type 345
14.2 Quick Guide to Dynamics 345
14.3 Dynamic Type Example 348
14.3.1 COM and Office 348
14.3.2 Dynamic Language 350
14.3.3 dynamic types in pure managed code 353
14.4 principle behind the scenes 358
14.4.1 DLR Introduction 358

14.4.3 how the C # compiler handles dynamic 362
14.4.4 Smarter C # compiler 365
14.4.5 constraints of dynamic code 368
14.5 Implementing dynamic Behavior 370
14.5.1 using ExpandoObject 370
14.5.2 using DynamicObject 374
14.5.3 Implementation Idynamicmetaobject-provider 380
14.6 Summary 383
The 15th chapter uses contracts to make the code clearer 385
15.1 State before code contract is introduced 386
15.2 Code Contract 387
15.2.1 Pre-conditions 388
15.2.2 Post conditions 389
15.2.3 Fixed Conditions 390
15.2.4 assertions and assumptions 392
15.2.5 Old Covenant 393
15.3 Rewrite binary 394 with Ccrewrite and Ccrefgen
15.3.1 Simple rewrite 394
15.3.2 Contract Inheritance 395
15.3.3 Contract Reference Assembly 398
15.3.4 Failure Behavior 399
15.4 Static Check 401
15.4.1 Start static Check 401
15.4.2 Implicit Responsibility 403
15.4.3 Selective Check 406
15.5 using Ccdocgen to document a contract 408
15.6 Contract Combat 410
What's in the 15.6.1 contract? 410
15.6.2 How to start 411
15.6.3 ubiquitous Option 412
15.7 Summary 414
16th Chapter 415
16.1 c#--The combination of tradition and modernity 415
16.2 computer Science and. NET 416
16.3 Computer World 417
16.4 Farewell 417
Appendix A LINQ standard query operator 419
Generic collection in Appendix B. NET 430
Appendix C Version Summary 440







: Network Disk Download





Deep understanding of C # (2nd edition) pdf


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.