C# 101 - Introduction and Development Environment Setup
Tags: csharp, tutorial, beginners, webdev
Published: 2020-08-03 05:24:53

With the current situation going around the world, people are spending a lot of time at their homes. It is the best time to pick up coding even if you have never written a line of code before in your life. 

I know the thought of coding seems to be very daunting at the beginning but believe me, it is easy and fun once you get the hang of it.

So to get people to start coding I have started this series for **FREE. Yes, it is 100% FREE !!!**

There are a lot of languages to choose from like Python, Java, C, and C++, etc. There is nothing wrong with the above languages, in fact, Python is really beginner-friendly but I started my career with C# and it still has a lot of demand in the market. C# is used by a number of huge enterprises and will always be in demand as long as Microsoft exists. 

I have opted for C# as I have had a working experience of 3+ years in .NET and I would love to show how easy it can be to get started with it.

## Introduction to C# (The Theory)  

#### What is C#?
* C# is an Object Oriented Programming language developed by Microsoft. 
* It is used for developing web applications, windows applications, and mobile applications.  

#### History of C# -
* It was launched in 2002 with .NET Framework 1.0 
* There have been a lot of increments over the years and the current version of C# is 8.0 (released in 2019).

#### Advantages of C# -
* It is a modern language with simple syntax. It is very easy to learn.
* It has a variety of features like collections, generics, and garbage collection, etc. 
* It supports cross-language interoperability i.e. it can communicate easily with code written in other languages. 

## Setting Up The Development Environment
Please follow the steps mentioned below to get everything you need to start coding in C# -
1. Download and install Visual Studio 2019 Community Edition from [Microsoft](https://visualstudio.microsoft.com/)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lce7io6ijoa2i1hcl9nq.PNG)
2. Download and install .NET Core SDK from [.NET Site](https://dotnet.microsoft.com/download) 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/i220691czw9oeq3e0u5u.PNG)
3. Open Visual Studio 2019 and we can get started. 

## Our Very First Program - HELLO WORLD
In this section, we will be building our very first console application which displays HELLO WORLD on the screen. 

1. Open Visual Studio. Go to Files -> New -> Project
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1fbjeyf03q4wg6n7hoqi.PNG)
2. In the type of project selection screen, select 'Console App(.NET Core)' 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nbiqr1kfjr060cbqxhpo.PNG)
3. Now, in the 'Configure Project' screen, give the project name and desired location, and then click on next. 
 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/800ezh6jrak4w6hvtdvh.PNG)
4. Visual Studio will not automatically generate a basic file structure and you will see a file called Program.cs
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1ef69wfwsb5hm59i5icx.PNG)
5. Content of Program.cs file should be - 
```
using System;

namespace HelloWorldApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}
```
Here, the `Main()` method is the first method that is called automatically when we run the program. 
The `Console.WriteLine()` method is used to print whatever is inside the parenthesis to the console. Feel free to change the text from Hello world to something else if you like. 
6. To run the app we need to click on the 'run' button / green play button on the top center of the visual studio. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rv5jovmuwexa45qnjsss.PNG)
7. A black console window will pop up which displays the text written inside the `Console.WriteLine()`
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/etdjvqhvhghsa7wlymb5.PNG)

**Congratulation!!** You have successfully build your first program. 

If you liked this tutorial please hit the like button :) 
Also, follow me as I will be posting the next tutorial very soon. Stay tuned my curious learners and thanks for reading.