9780321658708

Effective C# (Covers C# 4.0) 50 Specific Ways to Improve Your C#

by
  • ISBN13:

    9780321658708

  • ISBN10:

    0321658701

  • Edition: 2nd
  • Format: Paperback
  • Copyright: 2010-03-05
  • Publisher: Addison-Wesley Professional
  • View Upgraded Edition

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $12.50
  • Buy Used
    $37.49
    Add to Cart Free Shipping

    USUALLY SHIPS IN 2-4 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

Powerful, practical advice and tips for seasoned C# developers, in Scott Meyers' enormously popular 'Effective' format--Presents 50 high-performance C# 4.0 shortcuts and tricks not available anywhere else.-Leading-edge techniques leveraging everything from LINQ and generics to C# 4.0's new dynamic features.-Targeted to publish at or near the release date of Microsoft's eagerly anticipated C# 4.0.-Completely revamps a book originally written for C# 1.x In Effective C# 4.0, Microsoft C# MVP and Regional Director Bill Wagner  introduces fifty powerful ways to write more efficient and more robust software with C# 4.0, the eagerly anticipated new version of C#. As in the first edition, Wagner presents tips and techniques available in no other book or C# class, providing clear, practical explanations, expert tips, and plenty of realistic code examples. This edition's code is designed to fully reflect the latest C# language capabilities and coding best practices, and addresses topics ranging from generics and LINQ to C# 4.0's newest dynamic features. Wagner's farreaching coverage addresses C# language elements, .NET resource management, expressing designs with C#, and many other aspects of C# development. This book follows the same format as Wagner's best-selling first edition and followup More Effective C# : the concise, scenario-driven style originally pioneered by Scott Meyers in his best-selling Effective C++ . C# 4.0 is expected  to debut Q1 2010 

Author Biography

With more than twenty years of experience, Bill Wagner, SRT Solutions cofounder, is a recognized expert in software design and engineering, specializing in C#, .NET, and the Azure platform. He serves as Michigan’s Regional Director for Microsoft and is a multiyear winner of Microsoft’s MVP award. An internationally recognized writer, Bill is the author of the first edition of this book and More Effective C# (Addison-Wesley, 2009) and currently writes a column on the Microsoft C# Developer Center. Bill earned a B.S. in computer science from the University of Illinois at Champaign-Urbana.

Table of Contents

Introduction xiii

 

Chapter 1: C# Language Idioms 1

Item 1: Use Properties Instead of Accessible Data Members 1

Item 2: Prefer readonly to const 8

Item 3: Prefer the is or as Operators to Casts 12

Item 4: Use Conditional Attributes Instead of #if 20

Item 5: Always Provide ToString() 28

Item 6: Understand the Relationships Among the Many Different Concepts of Equality 36

Item 7: Understand the Pitfalls of GetHashCode() 44

Item 8: Prefer Query Syntax to Loops 51

Item 9: Avoid Conversion Operators in Your APIs 56

Item 10: Use Optional Parameters to Minimize Method Overloads 60

Item 11: Understand the Attraction of Small Functions 64

 

Chapter 2: .NET Resource Management 69

Item 12: Prefer Member Initializers to Assignment Statements 74

Item 13: Use Proper Initialization for Static Class Members 77

Item 14: Minimize Duplicate Initialization Logic 79

Item 15: Utilize using and try/finally for Resource Cleanup 87

Item 16: Avoid Creating Unnecessary Objects 94

Item 17: Implement the Standard Dispose Pattern 98

Item 18: Distinguish Between Value Types and Reference Types 104

Item 19: Ensure That 0 Is a Valid State for Value Types 110

Item 20: Prefer Immutable Atomic Value Types 114

 

Chapter 3: Expressing Designs in C# 125

Item 21: Limit Visibility of Your Types 126

Item 22: Prefer Defining and Implementing Interfaces to Inheritance 129

Item 23: Understand How Interface Methods Differ from Virtual Methods 139

Item 24: Express Callbacks with Delegates 143

Item 25: Implement the Event Pattern for Notifications 146

Item 26: Avoid Returning References to Internal Class Objects 154

Item 27: Prefer Making Your Types Serializable 157

Item 28: Create Large-Grain Internet Service APIs 166

Item 29: Support Generic Covariance and Contravariance 171

 

Chapter 4: Working with the Framework 179

Item 30: Prefer Overrides to Event Handlers 179

Item 31: Implement Ordering Relations with IComparable<T> and IComparer<T> 183

Item 32: Avoid ICloneable 190

Item 33: Use the new Modifier Only to React to Base Class Updates 194

Item 34: Avoid Overloading Methods Defined in Base Classes 198

Item 35: Learn How PLINQ Implements Parallel Algorithms 203

Item 36: Understand How to Use PLINQ for I/O Bound Operations 215

Item 37: Construct Parallel Algorithms with Exceptions in Mind 220

 

Chapter 5: Dynamic Programming in C# 227

Item 38: Understand the Pros and Cons of Dynamic 227

Item 39: Use Dynamic to Leverage the Runtime Type of Generic Type Parameters 236

Item 40: Use Dynamic for Parameters That Receive Anonymous Types 239

Item 41: Use DynamicObject or IDynamicMetaObjectProvider for Data-Driven Dynamic Types 243

Item 42: Understand How to Make Use of the Expression API 254

Item 43: Use Expressions to Transform Late Binding into Early Binding 261

Item 44: Minimize Dynamic Objects in Public APIs 267

 

Chapter 6: Miscellaneous 275

Item 45: Minimize Boxing and Unboxing 275

Item 46: Create Complete Application-Specific Exception Classes 279

Item 47: Prefer the Strong Exception Guarantee 284

Item 48: Prefer Safe Code 294

Item 49: Prefer CLS-Compliant Assemblies 298

Item 50: Prefer Smaller, Cohesive Assemblies 303

 

Index 309

Rewards Program

Customer Reviews

Amazingly Effective August 18, 2011
by
Although I knew some of the tricks/tips mentioned in this textbook, majority of them were new and intriguing. Simple and easy to understand examples even on advanced concepts make this an asset for any C# developer. For any issues on C# (up until version 4), I'll use this textbook as a constant reference guide.
Flag Review
Please provide a brief explanation for why you are flagging this review:
Submit
Your submission has been received. We will inspect this review as soon as possible. Thank you for your input!
Effective C# (Covers C# 4.0) 50 Specific Ways to Improve Your C#: 5 out of 5 stars based on 1 user reviews.

Write a Review