C# 3.0 Cookbook 3rd Edition is the latest rendition of the C# Cookbook that has been around since 2003. This one is bigger and better than ever, with helpful recipes that are up to date with the new technology that is included in C# 3.0. The authors have reworked many of the solutions to take advantage of these enhancements.
C# 3.0 Cookbook 3rd Edition is geared for users of every level and contains solutions to problems that developers encounter every day, as well as those obscure items that one can encounter, and have trouble finding a solution for. All in all over 250 'recipes' are presented covering a wide range of topics that will help you solve real life situations. C# 3.0 Cookbook is 886 pages in length and is divided into 20 chapters.
Chapter 1, "Language Integrated Query (LINQ)," is the new way to access data from many different sources. This is a more functional style of programming that helps take programming down a more declarative path that dramatically shortens the amount of code needed to perform some tasks. There are recipes that show usage with Objects, ADO.NET, and XML. Chapter 2, "Strings and Characters," contain topics such as comparing strings, decoding/encoding strings and other techniques that deal with strings and char's
Chapter 3, "Classes and Structures," deals with both class and structure data types. Covered here are a large amount of recipes covering design patterns, building clonable classes, disposing of unmanaged resources, and even converting a class to a full blown command line argument processing system. Chapter 4, "Generics," is about the ability to have code operate uniformly on values of different types. Here you will find out when to use generics, how to mark read-only collections the generic way, and how to initialize generic variables to their default value.
Chapter 5, "Collections," contains recipes that manage collections. Some of the tasks you will see here is how to write a more flexible stack trace path, retrieving all instances of a specific item in a list, and create a read-only array or list. Chapter 6, "Iterators, Partial Types, and Partial Methods," concentrate on two different problems. One is using iterators for generic and custom iterator implementations, and the other is partial types and methods for better segmenting your code, as well as generating code that is more easily extensible.
Chapter 7, "Exception Handling," shows you how best to implement error handling in your application. You will see when to catch and re-throw errors, create exception types, and deal with unhandled exceptions in different types of applications. Chapter 8, "Diagnostics," shows you how to work with data types that fall under the System.Diagnostic namespace. These include Debug/Trace classes, event logs, performance counters, and custom debugger displays.
Chapter 9, "Delegates, Events, and Lambda Expressions," examines each of these in detail. A delegate is an object which represents a method and, optionally the "this" object with that method. An Event is a specialized delegate type primarily used for messaging. Lambda Expressions provide a more concise, functional syntax for writing anonymous methods, which allow code blocks to be written inline where delegate values are expected. Chapter 10, "Regular Expressions," covers the use of the set of classes that are employed to run regular expressions against strings. Included is a recipe that contains many common patterns such as verify an e-mail address, match a zip code, match the format of a social security number, and match or verify a URL.
Chapter 11, "Data Structures and Algorithms," implements certain data structures and algorithms that are not in the Framework Class Library. Here are items such as queues, maps, trees, and hashes are examined. Chapter 12, "Filesystem I/O," looks at four different ways of file system interaction. First is the typical based on the file, second are folder based actions, third is with paths, or temporary files, and finally focuses on advanced file system I/O.
Chapter 13, "Reflection," covers ways to use the built-in assembly inspection system provided by the .NET Framework to determine what types, interfaces, and methods are implemented in an assembly. Chapter 14, "Web," focuses on accessing a website, its content, and programmatically determining website configuration.
Chapter 15, "XML," examines some of the uses for XML and how to program against it using LINQ to XML as well as other methods. Chapter 16, "Networking,," shows how to work with the connectivity option provided by the .NET Framework.
Chapter 17, "Security," describes some of the many ways to write secure code and protect data using the .NET framework such as controlling access to types, encryption/decryption, as well as using programmatic and declarative security. Chapter 18, "Threading and Synchronization," shows you how to use multiple threads of execution in a .NET program, as well as addressing issues such as protecting resources and how to use synchronization primitives to write thread-safe code.
Chapter 19, "Toolbox," contains recipes for those items that come up over and over again as well as those that come up less frequently. Covered here are things like determining the operating system, controlling a service, and dealing with operating system shutdown, power management, or user session changes. Chapter 20, "Numbers and Enumerations," focuses on numeric and enumeration data types. Topics such as whether a string is a valid number, rounding a floating point value, as well as other forms of numeric testing.
As with all of the Cookbook series, C# 3.0 Cookbook 3rd Edition presents the problem, gives you the solution and then presents a discussion about the solution. Sometimes the discussion is brief, and sometimes it can last pages depending on the complexity of the problem. At the end of each recipe is a "see also" section that directs you to further information on the topic. This gives you the opportunity to understand the problem, solve it and learn about any potential trade-offs to the solution.
Along with the presentation of the solutions, what I like about C# 3.0 Cookbook, 3rd Edition is that it is the go-to book for solving problems. While it is not the kind of book that you can learn C# with, it is the kind of book that you want to have around when you are learning C#. It will also help you grow as a developer and save you time, energy, and frustration when you need it most. If you are a C# developer, or is someone who is learning C# and wants to grow in their abilities then I highly recommend C# 3.0 Cookbook 3rd Edition.Powered by Sidelines