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 .NET?


While we are referring to .NET (pronounced as dot NET), it is .NET Full, as we have .NET Core in place and we are using .NET Core in our book examples with C# 7.0 as the language. Before moving ahead, you should know about .NET because there is a .NET Standard available with the .NET Core, that is API servers for both .NET Framework as well .NET Core. So, if you created a project using .NET Standard it is valid for both .NET Framework and .NET Core.

.NET is nothing but a combination of languages, runtime, and libraries, by using which we can develop managed software/applications. The software written in .NET is managed or is in a managed environment. To understand managed, we need to dig into how binary executables are available for operating systems. This comprises three broader steps:

  1. Writing the code (source code).
  2. Compiler compiles the source code.
  3. The operating system executes the binary executable immediately:

Broader steps – how binary executable is available?

The preceding process is a standard process depicting how compilers compile the source code and create executable binaries, but in the case of .NET, the compiler (C# compiler for our code) does not directly provide a binary executable; it provides an assembly and this assembly consists of metadata and intermediate language code, also known as Microsoft Intermediate Language (MSIL) or Intermediate Language (IL). This MSIL is a high-level language and this can’t be understood directly by the machine, as MSIL is not machine-specific code or byte code. For proper execution, it should be interpreted. This interpretation from MSIL or IL to the machine language happens with the help of JIT. In other words, JIT compiles MSIL, IL into the machine language, also called native code. For more information, refer to https://msdn.microsoft.com/en-us/library/ht8ecch6(v=vs.90).aspx.

For 64-bit compilation, Microsoft has announced RyuJIT (https://blogs.msdn.microsoft.com/dotnet/2014/02/27/ryujit-ctp2-getting-ready-for-prime-time/). In the coming versions, 32-bit compilation will also be handled by RyuJIT (https://github.com/dotnet/announcements/issues/10). After this, we can now have a single code base for both CoreCLR.

Note

Intermediate language is a high-level component-based assembly language.

In our seven days of learning, we will not focus on the framework, but we will be more focused on the C# language with the use of .NET Core. In the coming sections, we will discuss important things of .NET Core in such a way that while we work with a C# program, we should understand how our program talks with the operating system.