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 Core?


.NET Core is a new general-purpose development environment introduced by Microsoft to meet cross-platform requirements. .NET Core supports Windows, Linux, and OSX.

.NET Core is an open source software development framework released under MIT License and maintained by the Microsoft and .NET community on the GitHub (https://github.com/dotnet/core) repository.

.NET Core features

Here are some important features of .NET Core, that make .NET Core an important evolution step in software development:

What makes .NET Core?

.NET Core is a combination of coreclr, corefx, and cli and roslyn. These are the main components of .NET Core composition.

What is .NET Standard?

The .NET Standard is a set of APIs that resolves the problems of code sharing while you’re trying to write cross-platform applications. Currently, Microsoft is working on .NET Standard 2.0 to make it streamlined, and these standards will be implemented by all, that is, .NET Framework, .NET Core, and Xamarin. With the use of .NET Standard (that is a set of APIs), you are ensuring that your program and class library will be available for all targeted .NET Frameworks and .NET Core. In other words, .NET Standard will replace Portable Class Libraries (PCL). For more information, refer to https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/.

Note

The .NET Standard 2.0 repository is available at https://github.com/dotnet/standard.

Till now, you've got an idea of .NET Core and a few other things that help build cross-platform applications. In the coming sections, we will prepare the environment in order to start learning the C# language using Visual Studio 2017 (preferably the community edition).

Available IDEs and editors for C#

Integrated Development Environment (IDE) is nothing but software facilitating the development of applications. On the other hand, editors are basically meant to add/update predefined or new content. When we talk about the C# editor, we are referring to an editor that helps write C# programs. Some editors come with a lot of add-ons or plugins and can compile or run the programs.

We will use Visual Studio 2017 as our preferred C# IDE; however, there are a few more C# IDEs and editors you can go with:

  1. Visual Studio Code: VS Code is an editor, and you can start by downloading it from https://code.visualstudio.com/. To start with VS Code, you need to install the C# extension from https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp.
  2. Cloud9: It is a web browser-based IDE. You can start it for free by signing up at https://c9.io/signup.
  3. JetBrain Rider: This is a cross-platform IDE by JetBrains. For more information, visit https://www.jetbrains.com/rider/.
  4. Zeus IDE: This is an IDE designed for the Windows platform. You can start using Zeus from https://www.zeusedit.com/index.html.
  1. Text editor: This is the way you can go without any installation; just use a text editor of your choice. I use Notepad++ (https://notepad-plus-plus.org/download/v7.3.3.html) and the Command Line Interface (CLI) to build code. Refer to https://docs.microsoft.com/en-us/dotnet/articles/core/tools/ to know more about how to start with the CLI.

There may be more alternative IDEs and editors, but they are not as important to us.

Setting up the environment

In this section, we will see step by step how to initiate the installation of Visual Studio 2017 (preferably, the community edition) on Windows 10:

  1. Start the Visual Studio setup.
  1. From Workloads, select the options you want to install. For our book, we need .NET desktop development and .NET Core:
  1. Click on Install to start the installation:
  1. Click Launch once the installation is completed.
  2. Sign up for Visual Studio using your Live ID.
  3. Select Visual C# as your development setting.
  4. You will see the start page as follows:

We are all set to start with our first step.