C# in Depth, Third Edition
Jon Skeet
Foreword by Eric Lippert
  • September 2013
  • ISBN 9781617291340
  • 616 pages
  • printed in black & white

The definitive what, how, and why of C#.

Eric Lippert, Coverity

C# in Depth, Third Edition updates the best-selling second edition to cover the new features of C# 5, including the challenges of writing maintainable asynchronous code. It preserves the uniquely insightful look into the tricky areas and dusty corners of C# that only expert Jon Skeet can provide.

Table of Contents show full

foreword

preface

acknowledgments

about this book

about the author

about the cover illustration

Part 1 Preparing for the journey

1. Chapter 1 The changing face of C# development

1.1. Starting with a simple data type

1.2. Sorting and filtering

1.3. Handling an absence of data

1.4. Introducing LINQ

1.5. COM and dynamic typing

1.6. Writing asynchronous code without the heartache

1.7. Dissecting the .NET platform

1.8. Making your code super awesome

1.9. Summary

2. Chapter 2 Core foundations: building on C# 1

2.1. Delegates

2.2. Type system characteristics

2.3. Value types and reference types

2.4. Beyond C# 1: new features on a solid base

2.5. Summary

Part 2 C# 2: Solving the issues of C# 1

3. Chapter 3 Parameterized typing with generics

3.1. Why generics are necessary

3.2. Simple generics for everyday use

3.3. Beyond the basics

3.4. Advanced generics

3.5. Limitations of generics in C# and other languages

3.6. Summary

4. Chapter 4 Saying nothing with nullable types

4.1. What do you do when you just don’t have a value?

4.2. System.Nullable and System.Nullable

4.3. C# 2’s syntactic sugar for nullable types

4.4. Novel uses of nullable types

4.5. Summary

5. Chapter 5 Fast-tracked delegates

5.1. Saying goodbye to awkward delegate syntax

5.2. Method group conversions

5.3. Covariance and contravariance

5.4. Inline delegate actions with anonymous methods

5.5. Capturing variables in anonymous methods

5.6. Summary

6. Chapter 6 Implementing iterators the easy way

6.1. C# 1: The pain of handwritten iterators

6.2. C# 2: Simple iterators with yield statements

6.3. Real-life iterator examples

6.4. Pseudo-synchronous code with the Concurrency and Coordination Runtime

6.5. Summary

7. Chapter 7 Concluding C# 2: the final features

7.1. Partial types

7.2. Static classes

7.3. Separate getter/setter property access

7.4. Namespace aliases

7.5. Pragma directives

7.6. Fixed-size buffers in unsafe code

7.7. Exposing internal members to selected assemblies

7.8. Summary

Part 3 C# 3: Revolutionizing data access

8. Chapter 8 Cutting fluff with a smart compiler

8.1. Automatically implemented properties

8.2. Implicit typing of local variables

8.3. Simplified initialization

8.4. Implicitly typed arrays

8.5. Anonymous types

8.6. Summary

9. Chapter 9 Lambda expressions and expression trees

9.1. Lambda expressions as delegates

9.2. Simple examples using List and events

9.3. Expression trees

9.4. Changes to type inference and overload resolution

9.5. Summary

10. chapter 10 Extension methods

10.1. Life before extension methods

10.2. Extension method syntax

10.3. Extension methods in .NET 3.5

10.4. Usage ideas and guidelines

10.5. Summary

11. Chapter 11 Query expressions and LINQ to Objects

11.1. Introducing LINQ

11.2. Simple beginnings: selecting elements

11.3. Filtering and ordering a sequence

11.4. Let clauses and transparent identifiers

11.5. Joins

11.6. Groupings and continuations

11.7. Choosing between query expressions and dot notation

11.8. Summary

12. Chapter 12 LINQ beyond collections

12.1. Querying a database with LINQ to SQL

12.2. Translations using IQueryable and IQueryProvider

12.3. LINQ-friendly APIs and LINQ to XML

12.4. Replacing LINQ to Objects with Parallel LINQ

12.5. Inverting the query model with LINQ to Rx

12.6. Extending LINQ to Objects

12.7. Summary

Part 4 C# 4: Playing nicely with others

13. Chapter 13 Minor changes to simplify code

13.1. Optional parameters and named arguments

13.2. Improvements for COM interoperability

13.3. Generic variance for interfaces and delegates

13.4. Teeny tiny changes to locking and field-like events

13.5. Summary

14. Chapter 14 Dynamic binding in a static language

14.1. What? When? Why? How?

14.2. The five-minute guide to dynamic

14.3. Examples of dynamic typing

14.4. Looking behind the scenes

14.5. Implementing dynamic behavior

14.6. Summary

Part 5 C# 5: Asynchrony made simple

15. Chapter 15 Asynchrony with async/await

15.1. Introducing asynchronous functions

15.2. Thinking about asynchrony

15.3. Syntax and semantics

15.4. Asynchronous anonymous functions

15.5. Implementation details: compiler transformation

15.6. Using async/await effectively

15.7. Summary

16. Chapter 16 C# 5 bonus features and closing thoughts

16.1. Changes to captured variables in foreach loops

16.2. Caller information attributes

16.3. Closing thoughts

Appendix A: LINQ standard query operators

Appendix B: Generic collections in .NET

Appendix C: Version summaries

index

© 2014 Manning Publications Co.

About the book

If you're a .NET developer, you'll use C# whether you're building an advanced enterprise application or just slamming out a quick app. In C# 5 you can do amazing things with generics, lambda expressions, dynamic typing, LINQ, iterator blocks, and other features. But first you have to learn it in depth.

C# in Depth, Third Edition has been thoroughly revised to cover the new features of C# 5, including the subtleties of writing maintainable asynchronous code. You'll see the power of C# in action, learning how to work with high-value features that you'll be glad to have in your toolkit. And you'll learn to avoid hidden pitfalls of C# programming with the help of crystal clear explanations of "behind the scenes" issues.

What's inside

  • Updated for C# 5
  • The new async/await feature
  • How C# works and why

About the reader

This book assumes you've digested your first C# book and are hungry for more!

About the author

Jon Skeet is a Senior Software Engineer at Google, and a highly visible participant of newsgroups, user groups, international conferences, and the Stack Overflow Q&A site. Jon spends much of his day coding in Java, but his heart belongs to C#.


combo $49.99 pBook + eBook
eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

The best source for learning C# language features.

Andy Kirsch, Venga

Took my C# knowledge to the next level.

Dustin Laine, Code Harvest

A must-have book that every .NET developer should read at least once.

Dror Helper, Better Place

Easily the best C# reference I've found.

Jon Parish, Datasif