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 on why developers need to choose .NET over other frameworks. You can also read more about .NET here.

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.

The latest versions (as of Dec 2023) are:

  • C# 12.0

  • .NET 8.0

  • Visual Studio 2022 17.8.2

  • You can find more information here.

Prior to .NET version 5, the platform was usable only on Windows OS. (Read more)

Check installation

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

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

Download VS 2022 Community installer from here.

How is a C# program compiled to an executable?

For a detailed explanation, follow this link.

Structure of a C# program

Our first C# program

Here is a simplified program to begin with:

using System;

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

Last updated