More Effective C#

50 Specific Ways to Improve Your C#

E-book Engels 2017 9780134579320
Verwachte levertijd ongeveer 9 werkdagen

Samenvatting

In More Effective C#, Second Edition, world-renowned .NET expert Bill Wagner identifies and illuminates 50 intermediate-to-advanced techniques for writing exceptionally robust and well-performing C# 7.0 code. Reflecting the growing sophistication of the C# language and its development community, Wagner presents powerful new solutions to problems you’re likely to encounter every day.

 

Through three editions of Effective C#, Wagner’s clear explanations, expert tips, and realistic code examples have proven invaluable to hundreds of thousands of developers. With the publication of this title, Effective C#, Third Edition, and More Effective C#, Second Edition, have been completely reorganized to provide clear explanations, expert tips, and realistic code examples in a cohesive package for modern C#. More Effective C#, Second Edition, brings the same proven approach to the new features in C# 7.0, helping you perform familiar tasks more efficiently and effectively.

 

Drawing on his unsurpassed C# experience and key role on global C# standards committees, Wagner addresses object-oriented, functional, and service-oriented approaches to managing data with C#; better ways to express your intent to users and other programmers; and new opportunities to leverage powerful asynchronous and dynamic programming techniques.
Use properties instead of accessible data members (Item 1) Distinguish between value and reference types (Item 4) Understand relationships among multiple concepts of equality (Item 9) Avoid conversion operators in your APIs (Item 11) Understand how interface and virtual methods differ (Item 15) Avoid overloading methods defined in base classes (Item 19) Create method groups that are clear, minimal, and complete (Item 22) Enable immediate error reporting in iterators and async methods (Item 26) Use async methods for async work (Item 27) Avoid thread allocations and context switches (Item 30) Construct PLINQ parallel algorithms with exceptions in mind (Item 36) Use the thread pool instead of creating threads (Item 37) Use BackgroundWorker for cross-thread communication (Item 38) Use the smallest possible scope for lock handles (Item 41) Understand the pros and cons of dynamic programming (Item 43) Make full use of the expression API (Item 46) Minimize dynamic objects in public APIs (Item 47)

You’re already a successful C# programmer: this book will make you an outstanding one.

 

Content Update Program: This book is part of the InformIT Content Update Program. As updates are made to C#, sections of this book will be updated or new sections will be added to match updates to the technologies.

Register your product at informit.com/register for convenient access to downloads, updates, and corrections as they become available.

Specificaties

ISBN13:9780134579320
Taal:Engels
Bindwijze:e-book

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

<!--[if gte mso 9]><xml> </xml><![endif]--> <p style="margin:0px;">Introduction xi</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Chapter 1: Working with Data Types 1</p> <p style="margin:0px;">Item 1: Use Properties Instead of Accessible Data Members 1</p> <p style="margin:0px;">Item 2: Prefer Implicit Properties for Mutable Data 8</p> <p style="margin:0px;">Item 3: Prefer Immutability for Value Types 12</p> <p style="margin:0px;">Item 4: Distinguish Between Value Types and Reference Types 18</p> <p style="margin:0px;">Item 5: Ensure That 0 Is a Valid State for Value Types 24</p> <p style="margin:0px;">Item 6: Ensure That Properties Behave Like Data 28</p> <p style="margin:0px;">Item 7: Limit Type Scope by Using Tuples 34</p> <p style="margin:0px;">Item 8: Define Local Functions on Anonymous Types 39</p> <p style="margin:0px;">Item 9: Understand the Relationships Among the Many Different Concepts of Equality 45</p> <p style="margin:0px;">Item 10: Understand the Pitfalls of GetHashCode() 54</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Chapter 2: API Design 61</p> <p style="margin:0px;">Item 11: Avoid Conversion Operators in Your APIs 61</p> <p style="margin:0px;">Item 12: Use Optional Parameters to Minimize Method Overloads 65</p> <p style="margin:0px;">Item 13: Limit Visibility of Your Types 69</p> <p style="margin:0px;">Item 14: Prefer Defining and Implementing Interfaces to Inheritance 73</p> <p style="margin:0px;">Item 15: Understand How Interface Methods Differ from Virtual Methods 82</p> <p style="margin:0px;">Item 16: Implement the Event Pattern for Notifications 86</p> <p style="margin:0px;">Item 17: Avoid Returning References to Internal Class Objects 93</p> <p style="margin:0px;">Item 18: Prefer Overrides to Event Handlers 97</p> <p style="margin:0px;">Item 19: Avoid Overloading Methods Defined in Base Classes 100</p> <p style="margin:0px;">Item 20: Understand How Events Increase Runtime Coupling Among Objects 104</p> <p style="margin:0px;">Item 21: Declare Only Nonvirtual Events 107</p> <p style="margin:0px;">Item 22: Create Method Groups That Are Clear, Minimal, and Complete 113</p> <p style="margin:0px;">Item 23: Give Partial Classes Partial Methods for Constructors, Mutators, and Event Handlers 120</p> <p style="margin:0px;">Item 24: Avoid ICloneable Because It Limits Your Design Choices 125</p> <p style="margin:0px;">Item 25: Limit Array Parameters to params Arrays 129</p> <p style="margin:0px;">Item 26: Enable Immediate Error Reporting in Iterators and Async Methods Using Local Functions 134</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Chapter 3: Task-Based Asynchronous Programming 139</p> <p style="margin:0px;">Item 27: Use Async Methods for Async Work 139</p> <p style="margin:0px;">Item 28: Never Write async void Methods 143</p> <p style="margin:0px;">Item 29: Avoid Composing Synchronous and Asynchronous Methods 149</p> <p style="margin:0px;">Item 30: Use Async Methods to Avoid Thread Allocations and Context Switches 154</p> <p style="margin:0px;">Item 31: Avoid Marshalling Context Unnecessarily 156</p> <p style="margin:0px;">Item 32: Compose Asynchronous Work Using Task Objects 160</p> <p style="margin:0px;">Item 33: Consider Implementing the Task Cancellation Protocol 166</p> <p style="margin:0px;">Item 34: Cache Generalized Async Return Types 173</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Chapter 4: Parallel Processing 177</p> <p style="margin:0px;">Item 35: Learn How PLINQ Implements Parallel Algorithms 177</p> <p style="margin:0px;">Item 36: Construct Parallel Algorithms with Exceptions in Mind 189</p> <p style="margin:0px;">Item 37: Use the Thread Pool Instead of Creating Threads 195</p> <p style="margin:0px;">Item 38: Use BackgroundWorker for Cross-Thread Communication 201</p> <p style="margin:0px;">Item 39: Understand Cross-Thread Calls in XAML Environments 205</p> <p style="margin:0px;">Item 40: Use lock() as Your First Choice for Synchronization 214</p> <p style="margin:0px;">Item 41: Use the Smallest Possible Scope for Lock Handles 221</p> <p style="margin:0px;">Item 42: Avoid Calling Unknown Code in Locked Sections 225</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Chapter 5: Dynamic Programming 229</p> <p style="margin:0px;">Item 43: Understand the Pros and Cons of Dynamic Typing 229</p> <p style="margin:0px;">Item 44: Use Dynamic Typing to Leverage the Runtime Type of Generic Type Parameters 238</p> <p style="margin:0px;">Item 45: Use DynamicObject or IDynamicMetaObjectProvider for Data-Driven Dynamic Types 242</p> <p style="margin:0px;">Item 46: Understand How to Use the Expression API 253</p> <p style="margin:0px;">Item 47: Minimize Dynamic Objects in Public APIs 259</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Chapter 6: Participate in the Global C# Community 267</p> <p style="margin:0px;">Item 48: Seek the Best Answer, Not the Most Popular Answer 267</p> <p style="margin:0px;">Item 49: Participate in Specs and Code 269</p> <p style="margin:0px;">Item 50: Consider Automating Practices with Analyzers 271</p> <p style="margin:0px;">&nbsp;</p> <p style="margin:0px;">Index 273</p> <!--[if gte mso 9]><xml> Normal 0 false false false EN-US X-NONE X-NONE </xml><![endif]--> <!--[if gte mso 9]><xml> </xml><![endif]--> <!--[if gte mso 10]> <![endif]-->

Managementboek Top 100

Rubrieken

Populaire producten

    Personen

      Trefwoorden

        More Effective C#