![Amazon prime logo](https://cdn.statically.io/img/m.media-amazon.com/images/G/01/marketing/prime/new_prime_logo_RGB_blue._CB426090081_.png)
Enjoy fast, free delivery, exclusive deals, and award-winning movies & TV shows with Prime
Try Prime
and start saving today with fast, free delivery
Amazon Prime includes:
Fast, FREE Delivery is available to Prime members. To join, select "Try Amazon Prime and start saving today with Fast, FREE Delivery" below the Add to Cart button.
Amazon Prime members enjoy:- Cardmembers earn 5% Back at Amazon.com with a Prime Credit Card.
- Unlimited Free Two-Day Delivery
- Streaming of thousands of movies and TV shows with limited ads on Prime Video.
- A Kindle book to borrow for free each month - with no due dates
- Listen to over 2 million songs and hundreds of playlists
- Unlimited photo storage with anywhere access
Important: Your credit card will NOT be charged when you start your free trial or if you cancel during the trial period. If you're happy with Amazon Prime, do nothing. At the end of the free trial, your membership will automatically upgrade to a monthly membership.
Buy new:
-23% $45.94$45.94
Ships from: Amazon.com Sold by: Amazon.com
Save with Used - Like New
$6.58$6.58
FREE delivery July 26 - 31
Ships from: ThriftBooks-Atlanta Sold by: ThriftBooks-Atlanta
Learn more
1.27 mi | ASHBURN 20147
Returnable | Yes |
---|---|
Resolutions | Eligible for refund or replacement |
Return Window | 30 days from delivery |
Refund Timelines | Typically, an advance refund will be issued within 24 hours of a drop-off or pick-up. For returns that require physical verification, refund issuance may take up to 30 days after drop-off or pick up. Where an advance refund is issued, we will re-charge your payment method if we do not receive the correct item in original condition. See details here. |
Late fee | A late fee of 20% of the item price will apply if you complete the drop off or pick up after the ‘Return By Date’. |
Restocking fee | A restocking fee may apply if the item is not returned in original condition and original packaging, or is damaged or missing parts for reasons not due to Amazon or seller error. See details here. |
Return instructions
Item must be in original condition and packaging along with tag, accessories, manuals, and inserts. Unlock any electronic device, delete your account and remove all personal information. |
Returnable | Yes |
---|---|
Resolutions | Eligible for refund or replacement |
Return Window | 30 days from delivery |
Refund Timelines | Typically, an advance refund will be issued within 24 hours of a drop-off or pick-up. For returns that require physical verification, refund issuance may take up to 30 days after drop-off or pick up. Where an advance refund is issued, we will re-charge your payment method if we do not receive the correct item in original condition. See details here. |
Late fee | A late fee of 20% of the item price will apply if you complete the drop off or pick up after the ‘Return By Date’. |
Restocking fee | A restocking fee may apply if the item is not returned in original condition and original packaging, or is damaged or missing parts for reasons not due to Amazon or seller error. See details here. |
Return instructions
Item must be in original condition and packaging along with tag, accessories, manuals, and inserts. Unlock any electronic device, delete your account and remove all personal information. |
![Kindle app logo image](https://cdn.statically.io/img/m.media-amazon.com/images/G/01/kindle/app/kindle-app-logo._CB668847749_.png)
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Effective C#: 50 Specific Ways to Improve Your C# 1st Edition
Purchase options and add-ons
- ISBN-100321245660
- ISBN-13978-0321245663
- Edition1st
- PublisherAddison-Wesley Professional
- Publication dateDecember 3, 2004
- LanguageEnglish
- Dimensions6.93 x 0.74 x 9.13 inches
- Print length328 pages
Editorial Reviews
From the Back Cover
"This book really demonstrates Bill's strengths as a writer and programmer. In a very short amount of time, he is able to present an issue, fix it and conclude it; each chapter is tight, succinct, and to the point."
Josh Holmes, Independent Contractor
"The book provides a good introduction to the C# language elements from a pragmatic point of view, identifying best practices along the way, and following a clear and logical progression from the basic syntax to creating components to improving your code writing skills. Since each topic is covered in short entries, it is very easy to read and you'll quickly realize the benefits of the book."
Tomas Restrepo, Microsoft MVP
"The book covers the basics well, especially with respect to the decisions needed when deriving classes from System.Object. It is easy to read with examples that are clear, concise and solid. I think it will bring good value to most readers."
Rob Steel, Central Region Integration COE & Lead Architect, Microsoft
"Effective C# provides the C# developer with the tools they need to rapidly grow their experience in Visual C# 2003 while also providing insight into the many improvements to the language that will be hitting a desktop near you in the form of Visual C# 2005."
Doug Holland, Precision Objects
"Part of the point of the .NET Frameworkand the C# Language, in particularis to let the developer focus solving customer problems and deliver product, rather than spending hours (or even weeks) writing plumbing code. Bill Wagner's Effective C#, not only shows you what's going on behind the scenes, but shows you how to take advantage of particular C# code constructs. Written in a dispassionate style that focuses on the factsand just the factsof writing effective C# code, Wagner's book drills down into practices that will let you write C# applications and components that are easier to maintain as well as faster to run. I'm recommending Effective C# to all students of my .NET BootCamp and other C#-related courses."
Richard Hale Shaw, www.RichardHaleShawGroup.com
C#'s resemblances to C++, Java, and C make it easier to learn, but there's a downside: C# programmers often continue to use older techniques when far better alternatives are available. In Effective C#, respected .NET expert Bill Wagner identifies fifty ways you can start leveraging the full power of C# in order to write faster, more efficient, and more reliable software.
Effective C# follows the format that made Effective C++ (Addison-Wesley, 1998) and Effective Java (Addison-Wesley, 2001) indispensable to hundreds of thousands of developers: clear, practical explanations, expert tips, and plenty of realistic code examples. Drawing on his unsurpassed C# experience, Wagner addresses everything from value types to assemblies, exceptions to reflection. Along the way, he shows exactly how to avoid dozens of common C# performance and reliability pitfalls. You'll learn how to:
Use both types of C# constants for efficiency and maintainability, see item 2
Use immutable data types to eliminate unnecessary error checking, see item 7
Avoid the C# function that'll practically always get you in trouble, see item 10
Minimize garbage collection, boxing, and unboxing, see items 16 and 17
Take full advantage of interfaces and delegates, see items 19 though 22
Create CLS compliant assemblies that use noncompliant C# language features, see item 30
Improve reliability and maintainability by creating small, cohesive assemblies, see item 32
Leverage the full power of .NET's runtime diagnostics, see item 36
Know whenand when notto use reflection, see items 42 and 43
Preview the major enhancements in C# 2.0, see item 49
You're already a successful C# programmerthis book can help you become an outstanding one.
Bill Wagner is co-founder of and .NET consultant for SRT Solutions. A nationally recognized independent expert on .NET, he has been a regular contributor to ASP.NET Pro Magazine, Visual Studio Magazine, and the .NET Insight newsletter. In addition to being a Microsoft Regional Director, he is also active in the Southeast Michigan .NET User Group and the Ann Arbor Computing Society. He is author of The C# Core Language Little Black Book (The Coriolis Group, 2002).
© Copyright Pearson Education. All rights reserved.
About the Author
Excerpt. © Reprinted by permission. All rights reserved.
This book is designed to offer practical advice for the programmer on how to improve productivity when using the C# language and the .NET libraries. In it, I have comprised 50 key items, or minitopics, related to the most-frequently-asked questions that I (and other C# consultants) have encountered while working with the C# community.
I started using C# after more than 10 years of C++ development, and it seems that many C# developers are following suit. Throughout the book, I discuss where following C++ practices may cause problems in using C#. Other C# developers are coming to the language with a strong Java background; they may find some of these passages rather obvious. Because some of the best practices change from Java to C#, I encourage Java developers to pay special attention to the discussions on value types (see Chapter 1, "C# Language Elements"). In addition, the .NET Garbage Collector behaves differently than the JVM Garbage Collector (see Chapter 2, ".NET Resource Management").
The items in this book are the collection of recommendations that I most often give developers. Although not all items are universal, most of the items can be easily applied to everyday programming scenarios. These include discussions on Properties (Item 1), Conditional Compilation (Item 4), Immutable Types (Item 7), Equality (Item 9), ICloneable (Item 27), and the new Modifier (Item 29). It has been my experience that, in most situations, decreasing development time and writing good code are the primary goals of the programmer. Certain scientific and engineering applications may place the highest premium on the overall performance of the system. Still, for others, it's all about the scalability. Depending on your goals, you might find particular information more (or less) relevant under certain circumstances. To address this, I have tried to explain the goals in detail. My discussions on readonly and const (Item 2), Serializable Types (Item 25), CLS Compliance (Item 31), Web Methods (Item 34), and DataSets (Item 41) assume certain design goals. Those goals are spelled out in these items, so that you can decide what is most applicable for you in your given situation.
Although each item in Effective C# stands alone, it is important to understand that the items have been organized around major topics, such as C# language syntax, resource management, and object and component design. This is no accident. My goal is to maximize learning the material covered in the book by leveraging and building each item on earlier items. Don't let that keep you from using it as a reference, though. If you have specific questions, this book functions well as the ideal "ask-me" tool. Please keep in mind that this is not a tutorial or a guide to the language, nor is it going to teach you C# syntax or structure. My goal is to provide guidance on the best constructs to use in different situations.
Who Should Read this Book?
Effective C# is written for professional developers, those programmers who use C# in their daily work lives. It assumes that you have some experience with object-oriented programming and at least one language in the C family: C, C++, C#, or Java. Developers with a Visual Basic 6 background should be familiar with both the C# syntax and object-oriented design before reading this book. Additionally, you should have some experience with the major areas of .NET: Web Services, ADO.NET, Web forms, and Windows Forms. I reference these concepts throughout the book.
To fully take advantage of this book, you should understand the way the .NET environment handles assemblies, the Microsoft Intermediate Language (MSIL), and executable code. The C# compiler produces assemblies that contain MSIL, which I often abbreviate as IL. When an assembly is loaded, the Just In Time (JIT) Compiler converts that MSIL into machine-executable code. The C# compiler does perform some optimizations, but the JIT compiler is responsible for many more effective optimizations, such as inlining. Throughout the book, I've explained which process is involved in which optimizations. This two-step compilation process has a significant effect on which constructs perform best in different situations.
About the Content
Chapter 1,"C# Language Elements," discusses the C# syntax elements and the core methods of System.Object that are part of every type you write. These are the topics that you must remember every day when you write C# code: declarations, statements, algorithms, and the System.Object interface. In addition, all the items that directly relate to the distinction between value types and reference types are in this chapter. Many items have some differences, depending on whether you are using a reference type (class) or a value type (struct). I strongly encourage you to read the discussions on value and reference types (Items 6 through 8) before reading deeper into the book.
Chapter 2, ".NET Resource Management," covers resource management with C# and .NET. You'll learn how to optimize your resource allocation and usage patterns for the .NET managed execution environment. Yes, the .NET Garbage Collector makes your life much simpler. Memory management is the environment's responsibility, not yours. But, your actions can have a big impact on how well the Garbage Collector performs for your application. And even if memory is not your problem, nonmemory resources are still your responsibility; they can be handled through IDisposable. You'll learn the best practices for resource management in .NET here.
Chapter 3, "Expressing Designs with C#," covers object-oriented design from a C# perspective. C# provides a rich palette of tools for your use. Sometimes, the same problems can be solved in many ways: using interfaces, delegates, events, or attributes and reflection. Which one you pick will have a huge impact on the future maintainability of your system. Choosing the best representation of your design will help to make it easier for the programmers using your types. The most natural representation will make your intent clearer. Your types will be easier to use and harder to misuse. The items in Chapter 3 focus on the design decisions you will make and when each C# idiom is most appropriate.
Chapter 4, "Creating Binary Components," covers components and language interoperability. You'll learn how to write components that can be consumed by other .NET languages, without sacrificing your favorite C# features. You'll also learn how to subdivide your classes into components in order to upgrade pieces of your application. You should be able to release new versions of a component without redistributing the entire application.
Chapter 5, "Working with the Framework," covers underutilized portions of the .NET Framework. I see a strong desire in many developers to create their own software rather than use what's already been built. Maybe it's the size of the .NET Framework that causes this; maybe it's that the framework is completely new. These items cover the parts of the framework where I have seen developers reinvent the wheel rather than use what they've been given. Save yourself the time by learning how to use the framework more efficiently.
Chapter 6, "Miscellaneous," finishes with items that did not fit in the other categories and with a look forward. Look here for C# 2.0 information, standards information, exception-safe code, security, and interop.
A Word About the Items
My vision for these items is to provide you with clear and succinct advice for writing C# software. Some guidelines in the book are universal because they affect the correctness of a program, such as initializing data members properly (see Chapter 2). Others are not so obvious and have generated much debate in the .NET community, such as whether to use ADO.NET DataSets. While I personally believe that using them is a great timesaver (see Item 41), other professional programmers, whom I highly respect, disagree. It really depends on what you're building. My position comes from a timesaving stance. For others who write a great deal of software that transfer information between .NET- and Java-based systems, DataSets are a bad idea. Throughout the book, I support and have given justification for all the suggestions I make. If the justification does not apply to your situation, neither does the advice. When the advice is universal, I usually omit the obvious justification, which is this: Your program won't work otherwise.
Regarding C# 2.0
I say little about the upcoming C# 2.0 release; there are two reasons for this. First and foremost, most of the advice in this book applies just as well for C# 2.0 as it does for the current version. Although C# 2.0 is a significant upgrade, it is built on C# 1.0 and does not invalidate most of today's advice. Where the best practices will likely change, I've noted that in the text.
The second reason is that it's too early to write the most effective uses of the new C# 2.0 features. This book is based on the experience I've had--and the experience my colleagues have had--using C# 1.0. None of us has enough experience with the new features in C# 2.0 to know the best ways to incorporate them into our daily tasks. I'd rather not mislead you when the simple fact is that the time to cover the new C# 2.0 features in an Effective book has not yet arrived.
Product details
- Publisher : Addison-Wesley Professional; 1st edition (December 3, 2004)
- Language : English
- Paperback : 328 pages
- ISBN-10 : 0321245660
- ISBN-13 : 978-0321245663
- Item Weight : 1.46 pounds
- Dimensions : 6.93 x 0.74 x 9.13 inches
- Best Sellers Rank: #5,336,430 in Books (See Top 100 in Books)
- #1,167 in C# Programming (Books)
- #6,064 in Computer Programming Languages
- #46,201 in Professional
- Customer Reviews:
About the author
![Bill Wagner](https://cdn.statically.io/img/m.media-amazon.com/images/I/210QcTDgQsL._SY600_.jpg)
Bill has spent his entire career in the software industry, spanning both technical and business roles. He spent eight years as a self-employed consultant before co-founding SRT Solutions with Dianne Marsh. Over the past decade they’ve grown SRT Solutions into a premier software development company, amassing 4 FastTrack awards (2011, 2010, 2008, 2007), the Michigan 50 Companies to Watch award (2011), and making the Inc 500/5000 list (2011 and 2012). Bill was also awarded Automation Alley’s Emerging Technology Leader award in 2011.
His technical time is spent between curly braces, primarily with C#. He’s the author of the best selling “Effective C#”, now in its second edition, and “More Effective C#”. His articles have appeared in MSDN Magazine, the C# Developer Center, Visual C++ Developer’s Journal, Visual Studio Magazine, ASP.NET Pro, .NET Developer’s Journal and more. He’s written hundreds of technical articles for software developers. He actively blogs about technical and business topics. Bill is also a regional director for Microsoft.
In addition to his business and technical accomplishments, Bill is an active community participant. He volunteers as a math tutor for the Manchester, Mich. schools, where he works to inspire high schoolers to consider a technical career.
He received his B.S. in Computer Science from the College of Engineering at the University of Illinois at Urbana Champaign.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Customers find the information in the book good and the format lends itself well to quick reading sessions that stick in their minds.
AI-generated from the text of customer reviews
Customers find the information in the book good and a great resource for getting a first glimpse at advanced topics.
"...This book is a great resource for getting that first glimpse to advanced topics that every pro should strive for...." Read more
"...Maybe I'm just biased.Like I said,the information has been good...." Read more
"I found this book to contain very useful technical information...." Read more
Customers find the book very well suited for quick reading sessions that stick in their minds. They also say C# is pretty easy to get up to speed with coming from a C/C++ background.
"While C# is pretty easy to get up to speed with coming from a C/C++ background, the similarities can lead to costly blunders!..." Read more
"This is really a useful book... topics are only a few pages long and allow you to pick and choose what is immediately relevant to you and your..." Read more
"Great book..." Read more
-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
Like I said,the information has been good. Most of the first items revolve around distinguishing between behavior driven code vs data. It's a cool distinction and it's definitely been an eye opener. They cover cool things like what the differences in the MSIL look like (okay, I admittedly added a star after really rethinking this).
I think the book would have been better if there were some syntax highlighting in the examples. The examples in this book are way too similar between each other! It would be helpful if the authors would have put in some special coloring between examples to show what has changed OR what is really important to take away from the example! Instead it forced me to go through and really pick at the examples.
Overall I liked the book. I picked it up used, not sure if I would buy it new.
To me it is a must read for engineers writing/reviewing code in C#.
The only problem with it is that the language is a bit of a moving target so the most effective ways to use C# is changing. To me, instead of having an effective C# book and a more effective C# book they should have had just a second edition of the first. This probably is not likely to be solved as I imagine many will be just digesting C# 3.0 with 4.0 looming on the horizon. This, however, is beyond the authors control.
I'm taking it slow, reading one tip a day and reviewing the title of previously read tips each day in hopes to make these "Specific Ways" part of my nature as a C# developer. Several of them, such as "Prefer Properties to Accessible Members" were already apart of my normal practice, but others such as benefits of preferring "Conditional Attributes Instead of #if" were a surprise :-)
Also in the process of reading C# in Depth: What you need to master C# 2 and 3 and highly recommend it as well!... must haves for developers who strive to be experts at their craft.
Numerous typos, one every few pages, including the chapter heading for Item 8, were distracting. Some obvious factual errors, like page 63 and page 65 contradicting each other, made me question the accuracy all the content.
Top reviews from other countries
![](https://images-eu.ssl-images-amazon.com/images/S/amazon-avatars-global/default._CR0,0,1024,1024_SX48_.png)
This book is very open to people from a wide range of programming backgrounds, but a number of items do seem to be based on beating old style techniques out of Windows C++ programmers. If you are an old Windows C++ programmers it may seem that this book was written just for you.
My main criticism of this book is that I thought it had a tendency to describe items in an overly long and complicated way. But this is just a style issue and doesn't detract too much from the content. The things I loved the most were the debunking of common myths, such as 'avoid foreach' and 'avoid DataSets'. And my favourite item was a good example of how to program custom attributes to make reflection simpler and easier. This was a great example of attributes and a valid use of reflection and was the prefect precursor to the item 'Don't overuse reflection'.
Like all the 'Effective' books before it this is one to read once to get the general understanding, then to leave on your desk to reference again and again when the items become relevant to what you are doing at that moment.
![](https://images-eu.ssl-images-amazon.com/images/S/amazon-avatars-global/default._CR0,0,1024,1024_SX48_.png)
![](https://images-eu.ssl-images-amazon.com/images/S/amazon-avatars-global/default._CR0,0,1024,1024_SX48_.png)
Nun, bei "Effective C#" kam ich mir auch ein bisschen vor wie auf einer Kaffeefahrt...
Bill Wagner hat hier de facto ein Bündel guter Tipps und Best Practises für den fortgeschrittenen C# Entwickler geschnürt. Zu allen Punkten finden sich Erläuterungen, warum in den Augen des Autors etwas so und nicht anders gemacht werden sollte, zusammen mit einer Menge Beispielcode jeweils in kurzen Schnipseln. Das liest sich flüssig und trifft zu 90% tatsächlich den Nagel auf den Kopf. Es ist gut, eigene Vorgehensweisen bestätigt zu sehen und an vielen anderen Stellen neue Anstöße zu bekommen.
Alleine die Sprache gefällt mir häufig nicht. So stelle ich mir die Fernsehprediger im US-TV vor: "Do this. Do it now. And do it anytime, anywhere." Sätze in dieser Art finden sich zahlreich und man hat den Eindruck, Wagner will einem tatsächlich eine Heizdecke verkaufen resp. seine Lösungen doppelt und dreifach rhetorisch unterstreichen. Das hätte er gar nicht nötig, die Fakten im Buch sprechen für sich.
Nach der Lektüre wünscht man sich mehr und hofft, dass es bald ein neues Werk zu den besonderen Merkmalen in .NET 3.5 geben könnte. "Effective C#" beschränkt sich nämlich weitgehend auf C# 1.0 mit Schlenkern hin zu 2.0 (z.B. Generics). Das ist keine Einschränkung, denn was für 1.0 guter Stil war gilt zu weiten Teilen auch heute. Aber es lässt eben naturgemäß Spezialitäten in den Neuerungen aus.
1 Stern Abzug also nur für die IMHO allzu amerikanische Darstellungsweise.