# Introduction to C#.NET

## What is .NET?

.NET is a free, cross-platform, **open source** developer platform for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, and IoT. There is no specific reason as to why the name “.NET” was chosen for this framework! You can write .NET apps in C#, F#, or **Visual Basic**. NET that contains over 90,000 packages! You can read [more](https://dotnet.microsoft.com/en-us/platform/why-choose-dotnet) on why developers need to choose .NET over other frameworks. You can also read more about .NET [here](https://docs.microsoft.com/en-us/dotnet/core/introduction).

## Why use C#?

C# is a **statically typed** programming language which lets us write code that runs atop Microsoft's .NET framework. C# has more features and capabilities than Java. C# is object oriented and its syntax is very similar to Java. We could also use Visual Basic (VB) to write .NET apps, but C# is more popular because of it resemblance to C, C++ and Java!

### Versions

The first version of C# was in the year 2002, with the first version of .NET also. C# and .NET have independent version numbering, since both are constantly updated with new features, performance enhancements and bug fixes.&#x20;

**The latest versions (**&#x61;s of Dec 202&#x33;**) are:**

* **C#  12.0**&#x20;
* **.NET  8.0**
* **Visual Studio 2022  17.8.2**
* You can find more information [here](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history).

{% hint style="info" %}
Prior to .NET version 5, the platform was usable only on Windows OS. (Read [more](https://docs.microsoft.com/en-us/dotnet/core/introduction#implementations))
{% endhint %}

### Check installation&#x20;

We can check which version is installed, by using the below command:

```bash
dotnet --version
```

### Tools

For several years, **Visual Studio** (by Microsoft) was the only viable tool required to develop .NET applications. When we install it, all other things like .NET SDK, Runtime, Servers, Data Tools etc. are also installed. Now we can use **VS Code** [**also**](https://dotnet.microsoft.com/en-us/learntocode). VS code is a more modern and light weight approach to developing code, not just C# based, we could use it for virtually anything!

Even today the community edition of Visual Studio gives a better, full-fledged, productive and integrated atmosphere for .NET app development. You can read more [here](https://visualstudio.microsoft.com/downloads/).

{% hint style="info" %}
Download VS 2022 Community installer from [here](https://visualstudio.microsoft.com/vs/community/).
{% endhint %}

### How is a C# program compiled to an executable?

For a detailed explanation, follow [this](https://www.telerik.com/blogs/understanding-net-just-in-time-compilation) link.

<figure><img src="/files/M2zTGGWWqThOqEdg4jj5" alt=""><figcaption></figcaption></figure>

### Structure of a C# program

<figure><img src="/files/ZVPPDLwOz3AJxiZCLfTv" alt=""><figcaption></figcaption></figure>

### Our first C# program

#### Here is a simplified program to begin with:

```csharp
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, world!");
        //todo - print another line saying I love computers      
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://raviram.gitbook.io/c-programing/c-fundamental-concepts/introduction-to-c-.net.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
