This is the code repository for The Modern C# Challenge, published by Packt.
Become an expert C# programmer by solving interesting programming problems
In recent years, the C# and .NET ecosystem has grown so explosively that it's nearly impossible to keep up. This collection of programming challenges helps you explore some of the less-traveled byways of programming concepts in general and C# in particular.
This book covers the following exciting features:
- Perform statistical calculations such as finding the standard deviation
- Find combinations and permutations
- Search directories for files matching patterns using LINQ and PLINQ
- Find areas of polygons using geometric operations
- Randomize arrays and lists with extension methods
- Explore the filesystem to find duplicate files
- Simulate complex systems and implement equality in a class
- Use cryptographic techniques to encrypt and decrypt strings and files
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
private int FindError(string string1, string string2)
{
int error = 0;
for (int i = 0; i < string1.Length; i++)
error += Math.Abs((int)string1[i] - (int)string2[i]);
return error;
}
Following is what you need for this book:
Programming is best learned by doing rather than by reading, so I strongly encourage you to try to solve a problem before you look at my example solution later in the book. I've tried to include all of the information that you need to solve each problem in its description, so you should be able to take a crack at it before you look at my solution.
Even if you get stuck on a problem, the beginning of the solution's description may help you figure out how to solve it. If you experience an Ah ha! moment while you're reading about the solution, stop and give it another try.
Keep in mind that there are always multiple ways to solve any particular problem. Some solutions may be better than others, but most problems can be solved by several different approaches, so don't think your solution is wrong just because it's different from mine. In fact, yours may be better than mine.
The easiest way to read this book is from front to back, tackling each problem in order. The chapters are arranged so the less confusing topics come first. Similarly, the problems within each chapter are arranged with the less demanding first. Some of the material described in one problem's solution may also be used in a later solution, so reading the problems and their solutions in order makes sense.
However, the problems and their example solutions are described separately, so you can jump around if you like. For example, if you are particularly interested in steganography, you can jump straight to Chapter 9, Cryptography. The worst that will happen is that an example solution may refer you to an earlier solution for some of its details. You can then go back and read the earlier solution for further details.
With the following software and hardware list you can run all code files present in the book.
Chapter | Software required | OS required |
---|---|---|
1-9 | Visual Studio 2017 Community Edition or later | Windows, macOS, and Linux (Any) |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
Rod Stephens has been a software developer, consultant, instructor, and author. He has written more than 30 books and 250 magazine articles covering such topics as threedimensional graphics, algorithms, database design, software engineering, interview puzzles, C#, and Visual Basic. Rod's popular C# Helper and VB Helper websites receive millions of hits per year and contain thousands of tips, tricks, and example programs for C# and Visual Basic developers. Some of his most recent books include:
- WPF 3d: Three-Dimensional Graphics with WPF and C#
- Interview Puzzles Dissected: Solving and Understanding Interview Puzzles
- Beginning Software Engineering
- Essential Algorithms: A Practical Approach to Computer Algorithms
Click here if you have any feedback or suggestions.