|
With Tiny C# Projects by Denis Panjuta and Jafar Jabbarzadeh Want to learn C#? There’s no better way to learn than by practical application. This book teaches C# via fun, real-world projects. You’ll be writing C# in no time! Read on to learn more. |
Take 25% off Tiny C# Projects by entering fccpanjuta into the discount code box at checkout at manning.com.
Tiny C# Projects: learn with practical, real-world examples
If you’re reading this, then you’re probably interested in the C# programming language or in programming generally. Maybe you’re just starting out or maybe you’ve got a bit of experience. Either way, you’ve come to the right place!
This book consists of 10+ tiny projects intended to help readers learn and start coding in C#. Whether you are a total beginner or have already dabbled in C#, you will find help and inspiration in the projects covered in the book. All coding projects in the book consist of unique code, descriptions, and detailed explanations. By the time you’re done, you will not only have learned how to use different C# features, the basics of the language, and various productivity tips, you will also have created a portfolio with several projects. This book teaches not only the basics of the C# language, but will also show how to build a variety of useful apps. The projects covered in this book will help readers to acquire C# knowledge while building useful apps.
What’s inside the book
We start with the very basics of C#, and gradually explain how to increase project complexity and apply new features and concepts into projects. By building multiple projects and apps you will thoroughly learn the basics as well as some of the more complex topics, without getting mired in boring theory. As we mentioned, the book consists of 10+ projects (for now–this may change somewhat as the book progresses through MEAP), each with its own chapter, and each chapter will explain the idea of the project, the code behind it, and detailed instructions on how to build it. We have tremendous experience teaching students how to code and one of the most frequent pieces of feedback we have gotten is that we’re good at explaining difficult concepts to anyone—even beginners. You don’t need any other learning material to understand the concepts taught in this book.
The projects you will build throughout the book
Let’s get a better look at what you’re going to build and what you’re going to learn by building it.
1. Hello World!
In this intro, we will build a simple “Hello World” app. This will help us explore the IDE, compiler, build system, and package manager setup. This is a traditional starter project for learning a programming language and is the easiest project.
2. C# Datatypes and variables – A random number.
In this chapter, we will be learning about the development process of a random number generator. A random number between two preset values is displayed each time we run the script. This little algorithm will aid us in understanding the use of variables, the numerous datatypes that will be needed, how to generate a random value between two values, and finally, how to display our final value with a console write.
3. C# Operators and Conditionals – Two numbers
For our third tiny C# project, we will generate two random numbers and then compare them to determine which one is bigger. Then, we will check if the bigger one is higher than a set value and display in a Console.WriteLine() the result of both conditions.
This algorithm will use everything we learned previously, such as datatypes, the random class, concatenation, and everything we will learn during this chapter.
4. C# User Input – Guess the number
This chapter’s project will consist of a random number generator that will store that number and wait for the user to try and guess it. Each time a user input number is given, the algorithm will compare it to the random number generated and tell the user if the guessed number is too high, too low, or matched.
Although simple, this will significantly aid us in the understanding of methods in C# and the different ways of receiving runtime data from the user.
5. C# Collections and loops – Tic Tac Toe
In this chapter, we will create an application famous for its seemingly simple appearance but surprisingly complicated back-end, the well-known Tic-Tac-Toe minigame.
This project entails the need to master much more than what we worked on until now. This time, apart from variables, conditionals, console methods, and operators, we also need to step towards arrays, collections, and iterators. Even a simple AI is needed not to obligate the user to include a second player.
6. C# File System and String Manipulation – Guess the word
This project consists of a well-known game popular by its name “Hangman”. A random word gets displayed, and character by character, we try to guess it. This project will pick the random words from a file existing within the users’ hard drive and display the unguessed word on the console. The player then tries to guess it letter by letter. This chapter will teach us about the integrated file class from the System.IO namespace and demonstrate its most common use cases. Additionally, it will serve us as a proper introduction to string manipulation.
7. C# Async operations – Diffuse the bomb
For this project, we will build a simple game where the player must complete a sentence or solve a math problem before the time runs out. This app will teach the reader about async operations running in parallel. Parallel computing is a very important topic because of how GPUs work.
8. C# Checksum – File checksum checker
This project consists of building an app that will let the user detect corrupted files by checking their checksum against a fixed list of checksums. Software downloader apps use this method to check for corrupted files before re-downloading them. This app teaches the reader about reading files from a directory, what a file checksum is, and why it is useful.
9. C# Cryptography – Project – Secret message encryptor
For this project, we will build an app that uses the AES encryption algorithm to encrypt and decrypt a message. This app teaches the reader about the Cryptography class in C# and gives an idea of how two-way encryption works. This is a very important topic as security is a top concern in programming.
10. C# SMTP – Mass email sender
In this project, we will build an app that takes a message and sends it to a list of recipients via email. This teaches us the SMPT protocol and how to work with MailKit in C# to send Mime Messages using our Gmail account.
11. C# Chat bot – Discord e-commerce bot
This project is about learning how to automate basic E-Commerce info for clients using Discord. Nowadays, people use WhatsApp, slack, and Discord to extend their business reach. Most of the time, customers have a simple question about a listing: e.g., how much does a specific item cost, where can we buy it, or do we still have one in stock? In short, this project teaches us about chatbots and the use of the Discord API.
Who this book is for
Our target audience is interested in coding, learning new programming languages, and upgrading their skills. Most probably they already have basic programming knowledge, however, this book is suitable for complete beginners as well. Essentially, if you’re interested in learning to code or improving your coding skills, and/or want to see what C# is all about, this book is for you.
Manning Early Access Program (MEAP)
A book can take a year or more to write, but why wait that long? With MEAP, the Manning Early Access Program, you read a book chapter-by-chapter while it’s being written and get the final eBook as soon as it’s finished. Additionally, if you pre-order the print book, you’ll get it long before it’s available in stores. You also get a chance to let the author know what you think in the book’s forum, and help make a better book.
Also, all the readers of the book will have access to the author’s Discord community (Tutorials.EU), where students from different courses can share their projects, help each other, and ask questions to our moderators.
Summary
To sum it up, this book is for programming beginners who want to learn programming and C#, and programmers who want to get up to speed with C# and how it works.
To recap, you will learn:
- C# basics
- Random numbers and conditional statements
- Reading files from a directory and checksum
- The Cryptography class and two-way encryption
- Fundamentals of parallel computing with C#
- Implementing game logic, and dealing with 2D arrays and nested loops, as well as functions
- Data types and variables
- Using the SMTP protocol and MailKit in C# to send emails to a list
- Building basic chatbots with Discord
- Using web sockets
- And more!
And you’ll learn all of it by building useful apps!
If you want to learn more, check out the book here.