C# in Depth, Fourth Edition

Book description

C# in Depth, Fourth Edition is your key to unlocking the powerful new features added to the language in C# 5, 6, and 7. Following the expert guidance of C# legend Jon Skeet, you'll master asynchronous functions, expression-bodied members, interpolated strings, tuples, and much more.



About the Technology

The powerful, flexible C# programming language is the foundation of .NET development. Even after two decades of success, it's still getting better! Exciting new features in C# 6 and 7 make it easier than ever to take on big data applications, cloud-centric web development, and cross-platform software using .NET Core. There's never been a better time to learn C# in depth.



About the Book

C# in Depth, Fourth Edition is a revised edition of the bestseller written by C# legend Jon Skeet. This authoritative and engaging guide is your key to unlocking this powerful language, including the new features of C# 6 and 7. In it, Jon introduces expression-bodied members, interpolated strings, pattern matching, and more. Real-world examples drive it all home. By the end of this awesome book, you'll be writing C# code with skill, style, and confidence.



What's Inside
  • Comprehensive coverage of C# 6 and 7
  • Greatest hits of C# 2–5
  • Extended pass-by-reference functionality
  • String interpolation
  • Composition with tuples
  • Decomposition and pattern matching


About the Reader

For intermediate C# developers.



About the Author

Jon Skeet is a senior software engineer at Google. He studied mathematics and computer science at Cambridge, is a recognized authority in Java and C#, and maintains the position of top contributor to Stack Overflow.

We interviewed Jon as a part of our Six Questions series. Check it out here.



Quotes
Jon doesn’t just explain how C# works; he explains how the whole thing holds together as a unified design, and also points out when it doesn’t.
- From the Foreword by Eric Lippert, Facebook

Provides an excellent overview of the evolution of C# with helpful and realistic examples that make learning the newest features of C# easy.
- Meredith Godar, Innovative Software Engineering

This book has it all—from the beginnings of C# to insights on the future of the language and everything in between!
- Willem van Ketwich, National Australia Bank

Publisher resources

View/Submit Errata

Table of contents

  1. Copyright
  2. Brief Table of Contents
  3. Table of Contents
  4. Praise for the Third Edition
  5. Praise for the Second Edition
  6. Praise for the First Edition
  7. Foreword
  8. Preface
  9. Acknowledgments
  10. About this book
  11. About the author
  12. About the cover illustration
  13. Part 1. C# in context
    1. Chapter 1. Survival of the sharpest
      1. 1.1. An evolving language
      2. 1.2. An evolving platform
      3. 1.3. An evolving community
      4. 1.4. An evolving book
      5. Summary
  14. Part 2. C# 2–5
    1. Chapter 2. C# 2
      1. 2.1. Generics
      2. 2.2. Nullable value types
      3. 2.3. Simplified delegate creation
      4. 2.4. Iterators
      5. 2.5. Minor features
      6. Summary
    2. Chapter 3. C# 3: LINQ and everything that comes with it
      1. 3.1. Automatically implemented properties
      2. 3.2. Implicit typing
      3. 3.3. Object and collection initializers
      4. 3.4. Anonymous types
      5. 3.5. Lambda expressions
      6. 3.6. Extension methods
      7. 3.7. Query expressions
      8. 3.8. The end result: LINQ
      9. Summary
    3. Chapter 4. C# 4: Improving interoperability
      1. 4.1. Dynamic typing
      2. 4.2. Optional parameters and named arguments
      3. 4.3. COM interoperability improvements
      4. 4.4. Generic variance
      5. Summary
    4. Chapter 5. Writing asynchronous code
      1. 5.1. Introducing asynchronous functions
      2. 5.2. Thinking about asynchrony
      3. 5.3. Async method declarations
      4. 5.4. Await expressions
      5. 5.5. Wrapping of return values
      6. 5.6. Asynchronous method flow
      7. 5.7. Asynchronous anonymous functions
      8. 5.8. Custom task types in C# 7
      9. 5.9. Async main methods in C# 7.1
      10. 5.10. Usage tips
      11. Summary
    5. Chapter 6. Async implementation
      1. 6.1. Structure of the generated code
      2. 6.2. A simple MoveNext() implementation
      3. 6.3. How control flow affects MoveNext()
      4. 6.4. Execution contexts and flow
      5. 6.5. Custom task types revisited
      6. Summary
    6. Chapter 7. C# 5 bonus features
      1. 7.1. Capturing variables in foreach loops
      2. 7.2. Caller information attributes
      3. Summary
  15. Part 3. C# 6
    1. Chapter 8. Super-sleek properties and expression-bodied members
      1. 8.1. A brief history of properties
      2. 8.2. Upgrades to automatically implemented properties
      3. 8.3. Expression-bodied members
      4. Summary
    2. Chapter 9. Stringy features
      1. 9.1. A recap on string formatting in .NET
      2. 9.2. Introducing interpolated string literals
      3. 9.3. Localization using FormattableString
      4. 9.4. Uses, guidelines, and limitations
      5. 9.5. Accessing identifiers with nameof
      6. Summary
    3. Chapter 10. A smörgåsbord of features for concise code
      1. 10.1. Using static directives
      2. 10.2. Object and collection initializer enhancements
      3. 10.3. The null conditional operator
      4. 10.4. Exception filters
      5. Summary
  16. Part 4. C# 7 and beyond
    1. Chapter 11. Composition using tuples
      1. 11.1. Introduction to tuples
      2. 11.2. Tuple literals and tuple types
      3. 11.3. Tuple types and conversions
      4. 11.4. Tuples in the CLR
      5. 11.5. Alternatives to tuples
      6. 11.6. Uses and recommendations
      7. Summary
    2. Chapter 12. Deconstruction and pattern matching
      1. 12.1. Deconstruction of tuples
      2. 12.2. Deconstruction of nontuple types
      3. 12.3. Introduction to pattern matching
      4. 12.4. Patterns available in C# 7.0
      5. 12.5. Using patterns with the is operator
      6. 12.6. Using patterns with switch statements
      7. 12.7. Thoughts on usage
      8. Summary
    3. Chapter 13. Improving efficiency with more pass by reference
      1. 13.1. Recap: What do you know about ref?
      2. 13.2. Ref locals and ref returns
      3. 13.3. in parameters (C# 7.2)
      4. 13.4. Declaring structs as readonly (C# 7.2)
      5. 13.5. Extension methods with ref or in parameters (C# 7.2)
      6. 13.6. Ref-like structs (C# 7.2)
      7. Summary
    4. Chapter 14. Concise code in C# 7
      1. 14.1. Local methods
      2. 14.2. Out variables
      3. 14.3. Improvements to numeric literals
      4. 14.4. Throw expressions
      5. 14.5. Default literals (C# 7.1)
      6. 14.6. Nontrailing named arguments (C# 7.2)
      7. 14.7. Private protected access (C# 7.2)
      8. 14.8. Minor improvements in C# 7.3
      9. Summary
    5. Chapter 15. C# 8 and beyond
      1. 15.1. Nullable reference types
      2. 15.2. Switch expressions
      3. 15.3. Recursive pattern matching
      4. 15.4. Indexes and ranges
      5. 15.5. More async integration
      6. 15.6. Features not yet in preview
      7. 15.7. Getting involved
      8. Conclusion
  17. Language features by version
  18. Index
  19. List of Figures
  20. List of Tables
  21. List of Listings

Product information

  • Title: C# in Depth, Fourth Edition
  • Author(s): Jonathan Skeet
  • Release date: April 2019
  • Publisher(s): Manning Publications
  • ISBN: 9781617294532