Effective C# (Covers C# 6.0): 50 Specific Ways to Improve Your C#
Bill WagnerIn Effective C#, Third Edition,
respected .NET expert Bill Wagner identifies 50 ways to harness the
full power of the C# 6.0 language to write exceptionally robust,
efficient, and well-performing code. Reflecting the growing
sophistication of the C# language and its development community, Wagner
has identified dozens of new ways to write better code. This edition’s
new solutions include some that take advantage of generics and several
that are more focused on LINQ, as well as a full chapter of advanced
best practices for working with exceptions.
Wagner’s
clear, practical explanations, expert tips, and realistic code examples
have made Effective C# indispensable to hundreds of thousands of
developers. Drawing on his unsurpassed C# experience, he addresses
everything from resource management to multicore support, and reveals
how to avoid common pitfalls in the language and its .NET environment.
Learn how to choose the most effective solution when multiple options
exist, and how to write code that’s far easier to maintain and improve.
Wagner shows how and why to:
- - Prefer implicitly typed local variables
- - Replace string.Format() with interpolated strings
- - Express callbacks with delegates
- - Make the most of .NET resource management
- - Define minimal and sufficient constraints for generics
- - Specialize generic algorithms using runtime type checking
- - Use delegates to define method constraints on type parameters
- - Augment minimal interface contracts with extension methods
- - Create composable APIs for sequences
- - Decouple iterations from actions, predicates, and functions
- - Prefer lambda expressions to methods
- - Distinguish early from deferred execution
- - Avoid capturing expensive resources
- - Use exceptions to report method contract failures
- - Leverage side effects in exception filters
You’re already a successful C# programmer, and this book will make you an outstanding one.