C# in Depth, 3rd Edition

C# in Depth, 3rd Edition

Jon Skeet

Language: English

Pages: 616

ISBN: 161729134X

Format: PDF / Kindle (mobi) / ePub


Summary

C# in Depth, Third Edition updates the best-selling second edition to cover the new features of C# 5, including the challenges of writing maintainable asynchronous code. It preserves the uniquely insightful look into the tricky areas and dusty corners of C# that only expert Jon Skeet can provide.

About this Book

If you're a .NET developer, you'll use C# whether you're building an advanced enterprise application or just slamming out a quick app. In C# 5, you can do amazing things with generics, lambda expressions, dynamic typing, LINQ, iterator blocks, and other features. But first you have to learn it in depth.

C# in Depth, Third Edition has been thoroughly revised to cover the new features of C# 5, including the subtleties of writing maintainable asynchronous code. You'll see the power of C# in action, learning how to work with high-value features that you'll be glad to have in your toolkit. And you'll learn to avoid hidden pitfalls of C# programming with the help of crystal clear explanations of "behind the scenes" issues.

This book assumes you've digested your first C# book and are hungry for more!

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

What's Inside

  • Updated for C# 5
  • The new async/await feature
  • How C# works and why

About the Author

Jon Skeet is a Senior Software Engineer at Google, and a highly visible participant of newsgroups, user groups, international conferences, and the Stack Overflow Q&A site. Jon spends much of his day coding in Java, but his heart belongs to C#.

Table of Contents

    PART 1 PREPARING FOR THE JOURNEY
  1. The changing face of C# development
  2. Core foundations: building on C# 1
  3. PART 2 C# 2: SOLVING THE ISSUES OF C# 1
  4. Parameterized typing with generics
  5. Saying nothing with nullable types
  6. Fast-tracked delegates
  7. Implementing iterators the easy way
  8. Concluding C# 2: the final features
  9. PART 3 C# 3: REVOLUTIONIZING DATA ACCESS
  10. Cutting fluff with a smart compiler
  11. Lambda expressions and expression trees
  12. Extension methods
  13. Query expressions and LINQ to Objects
  14. LINQ beyond collections
  15. PART 4 C# 4: PLAYING NICELY WITH OTHERS
  16. Minor changes to simplify code
  17. Dynamic binding in a static language
  18. PART 5 C# 5: ASYNCHRONY MADE SIMPLE
  19. Asynchrony with async/await
  20. C# 5 bonus features and closing thoughts

Beginning iPhone Development: Exploring the iOS SDK (7th Edition)

iPhone and iPad Apps for Absolute Beginners (4th Edition)

C++ Recipes: A Problem-Solution Approach

Your Code as a Crime Scene: Use Forensic Techniques to Arrest Defects, Bottlenecks, and Bad Design in Your Programs

Eclipse Rich Client Platform (2nd Edition)

 

 

 

 

 

 

 

 

 

 

 

 

this.name = name; this.price = price; } public static List GetSampleProducts() { return new List { new Product(name: "West Side Story", price: 9.99m), new Product(name: "Assassins", price: 14.99m), new Product(name: "Frogs", price: 13.99m), new Product(name: "Sweeney Todd", price: 10.99m) }; } public override string ToString() { return string.Format("{0}: {1}", name, price); } } The benefits of this are relatively minimal in this particular example, but when a method or

ArrayList in .NET 1.1—but in .NET 2.0 it wouldn’t be crazy to do the same with a List. The second feature addresses another common cause of complaint, particularly when talking to databases—the fact that you can’t assign null to a value type variable. There’s no such concept as an int value of null, for instance, even though a database integer field may well be nullable. At that point it can be hard to model the database table within a statically typed class without ugliness of some form or

we’ll meet in chapter 9.) 130 Saying goodbye to awkward delegate syntax 131 C# 2 is a sort of stepping stone in terms of delegates. Its new features pave the way for the dramatic changes of C# 3, keeping developers reasonably comfortable while still providing useful benefits. I’m reliably informed that language designers were aware that the combined feature set of C# 2 would open up whole new ways of looking at code, but they didn’t necessarily know where those paths would lead. So far, their

white when you consider covariance and contravariance as applied to delegates. Suppose you have an event handling method that saves the current document, or just logs that it’s been called, or any number of other actions that may not need to know details of the event. The event itself shouldn’t mind that your method is capable of working with only the information provided by the EventHandler signature, even though it (the event) is declared to pass in mouse 132 CHAPTER 5 Fast-tracked

either less useful or less logical), but they also make it easy to produce horribly complicated code. Don’t let that discourage you from using them sensibly, though—they can save you masses of tedious code, and when they’re used appropriately they can be the most readable way of getting the job done. But what counts as sensible? GUIDELINES FOR USING CAPTURED VARIABLES The following is a list of suggestions for using captured variables:  If code that doesn’t use captured variables is just as

Download sample

Download

About admin