What this book covers
This book includes 100 problems to challenge you and help you develop your C# programming skills. The solutions rely on general programming methods rather than C# language minutiae, so you should have a chance to solve them even if you haven't been programming for decades. They demonstrate useful techniques, not the answers to trivia questions.
Many of the examples also demonstrate important development concepts, such as comparing floating point values, handling integer overflow, avoiding unnecessary recursion, working across time zones, and building simulations. Some examples also show how to use specific advanced C# and .NET Framework tools such as the yield statement, the Transact Parallel Library (TPL), and .NET cryptography classes.
The following paragraphs describe the book's chapters in some detail:
Chapter 1, Mathematics, describes problems that ask you to perform mathematical tasks. These include numerical tasks such as calculating statistical functions, factorials, and binomial coefficients. They also include some combinatorial tasks such as finding all of the permutations or combinations from a set of items.
Chapter 2, Geometry, presents problems that perform geometric calculations. These ask you to find values such as the roots of equations, the points where lines and circles intersect, and the areas of polygons. Many of these problems ask you to draw shapes such as lines, circles, arrowheads, polygons, and stars.
Chapter 3, Dates and Times, includes problems that deal with dates and times. They pay special attention to programs that include multiple time zones or that include times when daylight saving time (or the equivalent in other countries) starts or ends.
Chapter 4, Randomization, poses problems that use randomization to produce various kinds of randomized data. For example, they ask you to generate random floating point numbers within a range, pick random items from a list or array, and generate random passwords.
Chapter 5, Strings, describes problems that manipulate strings. For example, they require you to convert between numbers and roman numerals and between bytes and hexadecimal strings, detect palindromic substrings, validate passwords for correctness, and use the Soundex algorithm to represent word's sound.
Chapter 6, Files and Directories, covers problems that deal with the filesystem. Its problems ask you to remove blank lines from a file, calculate a directory's total size, detect duplicate files, and generate thumbnails for image files in a directory.
Chapter 7, Advanced C# and .NET Features, includes problems that deal with more advanced features such as Language Integrated Query (LINQ), Parallel LINQ (PLINQ), Transact Parallel Library (TPL), and the yield statement.
Chapter 8, Simulations, asks you to write programs that perform simulations. Those range from simple numeric or text-based simulations (such as Dawkins' weasel and finding hailstone sequences), to positional simulations (such as Langton's ant and Life), to simulations that model gravitational force and acceleration.
Chapter 9, Cryptography, describes cryptographic problems. Some, such as the problems that deal with Caesar and Vigenère ciphers, are interesting mostly for fun and historical perspective. Others, such as those that deal with prime numbers, hashing, and string encryption, demonstrate strong, modern cryptographic methods.
You may not learn something new from every problem in the book, but hopefully you'll learn something from many of them.