Contents
foreword
preface
acknowledgments
about this book
Part 1 Preparing for the journey
- Chapter 1 The changing face of C# development
- Starting with a simple data type
- Sorting and filtering
- Handling an absence of data
- Introducing LINQ
- COM and dynamic typing
- Dissecting the .NET platform
- Making your code super awesome
- Summary
- Chapter 2 Core foundations: building on C# 1
- Delegates
- Type system characteristics
- Value types and reference types
- Beyond C# 1: new features on a solid base
- Summary
Part 2 C# 2: solving the issues of C#
- Chapter 3 Parameterized typing with generics
- Why generics are necessary
- Simple generics for everyday use
- Beyond the basics
- Advanced generics
- Limitations of generics in C# and other languages
- Summary
- Chapter 4 Saying nothing with nullable types
- What do you do when you just don’t have a value?
- System.Nullableand System.Nullable
- C# 2’s syntactic sugar for nullable types
- Novel uses of nullable types
- Summary
- Chapter 5 Fast-tracked delegates
- Saying goodbye to awkward delegate syntax
- Method group conversions
- Covariance and contravariance
- Inline delegate actions with anonymous methods
- Capturing variables in anonymous methods
- Summary
- Chapter 6 Implementing iterators the easy way
- C# 1: the pain of handwritten iterators
- C# 2: simple iterators with yield statements
- Real-life iterator examples
- Pseudo-synchronous code with the Concurrency and Coordination Runtime
- Summary
- Chapter 7 Concluding C# 2: the final features
- Partial types
- Static classes
- Separate getter/setter property access
- Namespace aliases
- Pragma directives
- Fixed-size buffers in unsafe code
- Exposing internal members to selected assemblies
- Summary
Part 3 C# 3: revolutionizing how we code
- Chapter 8 Cutting fluff with a smart compiler
- Automatically implemented properties
- Implicit typing of local variables
- Simplified initialization
- Implicitly typed arrays
- Anonymous types
- Summary
- Chapter 9 Lambda expressions and expression trees
- Lambda expressions as delegates
- Simple examples using List and events
- Expression trees
- Changes to type inference and overload resolution
- Summary
- Chapter 10 Extension methods
- Life before extension methods
- Extension method syntax
- Extension methods in .NET 3.5
- Usage ideas and guidelines
- Summary
- Chapter 11 Query expressions and LINQ to Objects
- Introducing LINQ
- Simple beginnings: selecting elements
- Filtering and ordering a sequence
- Let clauses and transparent identifiers
- Joins
- Groupings and continuations
- Choosing between query expressions and dot notation
- Summary
- Chapter 12 LINQ beyond collections
- Querying a database with LINQ to SQL
- Translations using IQueryable and IQueryProvider
- LINQ-friendly APIs and LINQ to XML
- Replacing LINQ to Objects with Parallel LINQ
- Inverting the query model with LINQ to Rx
- Extending LINQ to Objects
- Summary
Part 4 C# 4: playing nicely with others
- Chapter 13 Minor changes to simplify code
- Optional parameters and named arguments
- Improvements for COM interoperability
- Generic variance for interfaces and delegates
- Teeny tiny changes to locking and field-like events
- Summary
- Chapter 14 Dynamic binding in a static language
- What? When? Why? How?
- The five-minute guide to dynamic
- Examples of dynamic typing
- Looking behind the scenes
- Implementing dynamic behavior
- Summary
- Chapter 15 Letting your code speak more clearly with Code Contracts
- Life before Code Contracts
- Introducing Code Contracts
- Rewriting binaries with ccrewrite and ccrefgen
- Static checking
- Documenting contracts with ccdocgen
- Practical contracts
- Summary
- Chapter 16 Whither now?
- C#—mixing tradition and modernity
- Computer science and .NET
- The world of computing
- Farewell
appendix A LINQ standard query operators
appendix B Generic collections in .NET
appendix C Version summaries
index