Book Image

Learn C# in 7 days

By : Gaurav Aroraa
1 (1)
Book Image

Learn C# in 7 days

1 (1)
By: Gaurav Aroraa

Overview of this book

This book takes a unique approach to teach C# to absolute beginners. You’ll learn the basics of the language in seven days. It takes a practical approach to explain the important concepts that build the foundation of the C# programming language. The book begins by teaching you the basic fundamentals using real-world practical examples and gets you acquainted with C# programming. We cover some important features and nuances of the language in a hands-on way, helping you grasp the concepts in a fluid manner. Later, you’ll explore the concepts of Object-Oriented Programming (OOP) through a real-world example. Then we dive into advanced-level concepts such as generics and collections, and you’ll get acquainted with objects and LINQ. Towards the end, you’ll build an application that covers all the concepts explained in the book. By the end of this book, you will have next-level skills and a good knowledge of the fundamentals of C#.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

What is programming?


There might be various definitions or various thoughts to define the word programming. In my view, programming is writing a solution in such a way that a machine (computer) can understand to depict the solution, which you can identify manually.

For example, let’s say you have a problem statement: find the total count of vowels from this book. If you want to find the solution to this statement, what will you do?

The probable steps for the solution to this problem are as follows:

  1. First, get the right book. I am assuming that you know the vowels (a, e, i, o, and u).
  1. How many vowels did you find in a book?--0 (zero).
  2. Open the current page (initially, our current page is 1) and start reading to find vowels.
  3. If the letter matches a, e, i, o, or u (please note that the case doesn’t matter, so the letters might as well be A, E, I, O, and U), then increase the vowel count by one.
  4. Is the current page completed?
  5. If the answer of step 5 is yes, then check if this is the last page of the book:
    • If yes, then we have the total vowel count in hand, which is nothing but n, where n is the total number of vowels found in the current chapter. Move to step 8 for the result.
    • If this is not the last chapter, move to the next chapter by adding 1 to the current chapter number. So, we should move to 1 + 1 = 2 (Chapter 2).
  6. In the next chapter, repeat steps 4 to 6 and until you reach the last chapter of the book.
  7. Finally, we have the total vowel count, that is, n (n is the total number of vowels found).

The preceding steps just described how we reached a perfect solution for our problem statement. These steps showed how we manually found the answer to our problem of counting all the vowels in the book's chapters.

In the programming world, such steps are collectively known as an algorithm.

Note

An algorithm is nothing but a process to solve a problem by defining a set of rules.

When we write the preceding step(s)/algorithm in such a way that a machine/computer will be able to follow the instructions, it is called programming. These instructions should be written in a language understood by the machine/computer, and this is what is called a programming language.

In this book, we will use C# 7.0 as the programming language and .NET Core as the framework.