1.1 What is C# and .NET?

Stasoz
5 min readMar 20, 2022

--

You can check this course on my website.

Get ready! We begin to dive into C# and, of course, let’s start with history.

Microsoft started developing C# back in 1998, and the first announcement took place in 2000. Since then, the language has gone through a large number of updates and improvements. The current version of the language is version C# 10.0, which was released on November 8, 2021. Today C# is one of the most powerful and in-demand languages in the IT industry.

The language itself uses a syntax that closely resembles C++ or Java. Therefore, if you have learned or written programs in these languages, then C# will be easier to learn.

C# is object-oriented and in this regard has taken over a lot from Java and C++. For example, C# supports polymorphism, inheritance, operator overloading, static typing. The object-oriented approach allows you to solve the problems of building large, but at the same time flexible, scalable and extensible applications. C# continues to evolve and with each new version, more and more interesting functionality appears.

What can you write in C#?

In its modern form, C# is capable of a lot of things. Today it is not in vain that it occupies a leading position in the lists of popular languages, since on its basis you can build almost any projects you like.

  • Mobile applications
  • Desktop applications
  • Web applications
  • Web services
  • Web sites
  • Games
  • Database applications

The Role of the .NET Platform

You’ve probably heard that when people talk about C#, they often mean technologies of the .NET platform (ASP.NET, WPF, Xamarin, and so on). Conversely, when people say about .NET, they often mean C#. Although these notions are related, but they are not the same. The C# language was created specifically to work with the .NET framework, but the concept of .NET itself is somewhat broader.

The .NET framework provides a powerful and large framework for building applications. Let’s take a look at its main features:

Cross-platform

The latest version of .NET 6 is supported on many modern operating systems: Windows, MacOS, Linux. The platform also provides various technologies thanks to which you can develop applications in C # for different platforms — Windows, MacOS, Linux, Android, iOS.

Multi-language support

The basis of the .NET platform is the Common Language Runtime (CLR), with the help of it .NET supports several languages besides C#, for example: C++, F#, VB.NET as well as dialects of other languages that are related to .NET, for example: Deplhi.

When compiling, the code in any of these languages is compiled into an assembly in the Common Intermediate Language (CIL) — a kind of assembler for the .NET platform. Therefore, under certain conditions and need, it is possible to make separate modules of one application in separate languages.

Performance

In a number of tests, .NET 6 web applications outperform web applications built with other technologies in different categories.

Powerful class library

.NET provides a single class library for all supported languages. And whatever application we are going to write in C# — a game, a website or a mobile application — one way or another we use the .NET class library.

In fact, you can imagine that this platform is like a kind of folder that contains other folders (libraries). At the same time, it is important to understand that in order to work in a certain area, you will also have to study a library suitable for this area.

Variety of technologies

As mentioned above, with C# you can write applications of any type and on any OS, for this purpose the .NET platform has a Common Language Runtime (CLR) environment and a basic class library which are the basis for a whole stack of technologies.

For example, ADO.NET and Entity Framework Core are designed to work with databases in this technology stack. For the development of cross-platform mobile and desktop applications — Xamarin / MAUI. For creating websites and web applications — ASP.NET etc.

Garbage collector

The developer does not need to worry about freeing memory as it needs to be done in C++, the CLR itself will call the garbage collector and clear the memory.

I have described superficially the benefits and role of the .NET platform and in more detail, I will describe in a separate section.

.NET Framework and .NET 6

It should be noted that .NET has developed as a platform for Windows called .NET Framework for a long time. In 2019, the latest version of this platform was released. NET Framework 4.8. It is no longer in development

Since 2014 Microsoft has been developing an alternative platform — .NET Core which was already intended for different platforms and should have absorbed all the possibilities .NET Framework and add new functionality. Microsoft then released a series of versions of this platform: .NET Core 1, .NET Core 2, .NET Core 3, .NET 5 and the current version is .NET 6.

Remember that the old . NET Framework is for Windows, but we will consider .NET 6 and C # 10, since this is the most current version.

Managed and unmanaged code

You may have heard that an application created on C# is called a managed code. What does that mean? This means that this application is based on the .NET platform and is therefore managed by the common language CLR environment which downloads the application and cleans memory if necessary.

At the same time the .NET platform provides possibilities for working with unmanageable code.

JIT compilation

C# code is compiled into applications or assemblies with exe or dll extensions in the CIL language. Next, when you start an application or assembly the JIT(Just in Time) compiles into machine code which is then executed.

An important advantage of the application is the ability to compile only the parts of the program that are needed at the moment. If the application does not access any part of the code it will not be compiled. At the time of access, instant compilation from CIL to machine code is performed.

All compiled blocks are not deleted, they are kept until the termination of work with the program. This helps to reduce the cost of system resources for recompilation.

This was a quick introduction to C# and the .NET platform. Let’s moving on to evolution of C#.

Contents

Next article -> 1.2 Evolution of C#

Join to our community in Telegram — https://t.me/itifico

If you want to support me, you can buy me a cup of coffee and I will drink it when I write the next article :)

Donations list:

  1. Dinesh Chintalapudi — 3$
  2. Unknown — 5$

--

--

Stasoz

Full Stack Developer who is inspired by new technologies