In this article, we’ll let you know the relation between the C# programming language and the .NET Platform.
Formation of .NET Platforms:
.NET Core, .NET Framework, Mono, and Xamarin are all both platforms and frameworks. The platform part refers to the runtime and compiler, while the framework part refers to the code library. Microsoft released the first version of C# under the .NET platform. This platform was built to enhance the software development platform for the Windows ecosystem through managed code and the virtual machine concept. C# is a high-level object-oriented, general-purpose programming language. While the C# syntax is similar to C++ and C, most of their features are not supported in C#. The idea behind this is to make programming in C# cleaner and more comfortable.
Programs written in C# are compiled through the C# compiler in the process of creating assemblies. Assemblies are files that share similar names with the program but have a different extension. You can identify groups with the extensions .dll or .exe. For example, if we create a Hello World program and compile HelloWorld.cs, you will see a file name HelloWorld.exe or HelloWorld.dll. There are lots of other files that can be created in the process.
Why is the .NET framework essential?
You get an error message when you try to run C# code on a computer without the .NET framework installed. Other than that, one of the benefits of the .NET framework is its automatic memory management. This is useful to programmers because, without it, you would have to manually allocate memory to objects and determine the appropriate time to release the memory from objects that no longer require such resources. It is safe to say that with the automatic memory management feature, .NET helps to improve the quality of programs and, at the same time, enhance your productivity.
The .NET framework has a unique component known as the garbage collector. This automated memory cleaning system checks when memory apportioned to different variables is not in use and releases it, making it available for other objects that might need that memory.
Another benefit of the .NET framework is that you can easily exchange code with other programmers, as long as the code in any of the .NET supported languages. Therefore, given that you are coding in C#, you can use code written by other programmers who write in F#, Managed C++, or VB.NET. All this is possible because all .NET languages use similar infrastructure for execution, data types, and assemblies.
The .NET framework runs effortlessly because of the common language runtime (CLR). This is the environment within which managed code is executed in C#. Because of the CLR, you can execute .NET programs on different operating systems and hardware systems. The CLR is essentially a virtual machine. It, therefore, supports memory access, instructions, registries, and input-output operations. Through the CLR, you can execute .NET programs using the competencies of the operating system and processor. What we refer to as the .NET platform, therefore, is a combination of the CLR, C# programming language, and a host of libraries and auxiliary instruments.