Blog for Junior Developers C#/.NET

Friday, June 28, 2024

When starting to learn programming in C#, it is worth knowing what C# actually is and what the platform on which these programs are run is, the .NET platform. If you are a junior programmer who wants to be a programmer aware of how the code you write works, be sure to read this article to the end. I will also try to introduce the .NET platform to people who do not program on a daily basis in any of the languages ​​related to .NET.

10-minute-guide-to-csharp-and-dotnet.jpg

10 Minute Guide to C# and .NET



What is C#?


C# (c sharp) was originally developed by Microsoft as a language in the .NET family. It is a fairly easy language, often recommended to people who want to start their adventure with programming. It was created by Anders Hejlsberg, who was also involved in the creation of languages ​​such as Delphi and Turbo Pascal. It was created on the basis of the C++ and C languages. The name was created in a similar way to the name of the C++ language (i.e. by adding the ++ increment operator to C). A similar mechanism was used for the name of the C# language, i.e. the increment operator (++) was added to C++ and this is how the # symbol was created. It is designed to resemble 4 combined + symbols. Initially, C# was very similar to Java, but over time, the similarity becomes less and less. It is an object-oriented language that resembles C++, but is easier to learn. A program written in C# is compiled into Intermediate Language (IL), i.e. intermediate code executed in the .NET runtime.


What is .NET Framework?


.NET Framework (dot net) is a programming platform developed by Microsoft, released in 2002. It includes Common Language Runtime (CLR), a runtime environment on which written programs run, as well as class libraries that implement typical functionalities used in applications .NET. The mentioned libraries are a set of functionalities and methods that facilitate the work of programmers. Thanks to which you can use ready-made implementations. The role of the .NET platform is, among other things, to manage application code, memory, and security. Programs for the .NET platform can be written in various languages, such as C#, F#, Delphi 8, Visual Basic .NET, COBOL, Eiffel, Fortran, Lisp, Perl. This is made possible by the idea of ​​using a common language, the so-called Common Language Specification (CLS). The most popular of the languages ​​mentioned is C#. These languages ​​are translated into Intermediate Language (IL), and only IL is run by the CLR. Sometimes, instead of IL, you may encounter the names CIL (Common Intermediate Language) and MSIL (Microsoft Intermediate Language), all these names mean the same thing. After compiling, the application code is saved on disk in assembly files with dll and exe extensions. .NET is an implementation of the CLR for the Windows operating system, so in order to run the application on another operating system, for example Linux, you had to use Mono (it was quite a complicated process). .NET Core has also been available for several years, thanks to which applications can run on various operating systems: Windows, Linux and Mac. When you run the compiled files, the operating system starts the aforementioned CLR process, which loads the IL code, compiling the code into machine instructions at runtime using the Just In Time (JIT) mechanism. The CLR also has a security control mechanism, as well as a Garbage Collector, which is responsible for cleaning up by removing objects to which there are no longer any references. The basic blocks of the .NET platform, in addition to the CLR and CLS mentioned above, also include the Common Type System (CTS), i.e. a common type system describing the data provided by the runtime environment, thanks to which programs can integrate with each other. The last block of the platform is also the Common Language Infrastructure (CLI), i.e. the standard for creating components in .NET (assembly).


.NET Core


.NET Core was released in 2016. It is open source software, thanks to which you can create and run your applications written in C#, among others, on Windows, Linux and macOS platforms. There was a bit of a revolution in 2020 as .NET 5 was released, which combined the .NET Framework with .NET Core.


Visual Studio


The most popular development environment (IDE) for a .NET developer is Visual Studio, which I also use every day and recommend to you. For your own use, you can use the free version of Visual Studio, which contains all the necessary functionalities. According to a survey conducted by stackoverflow, Visual Studio is used by approximately 31.5% of all developers, which is a very good result. Visual Studio makes the programmer's work easier by, among other things, displaying hints (intellisense), suggesting syntax, finding errors, coloring syntax, allowing you to debug the code, and has a built-in console. Once you start using Visual Studio, it's a good idea to also use keyboard shortcuts. I described the 40 most popular keyboard shortcuts in Visual Studio in a previous blog article.


What applications can be written in C#?


C# is a general-purpose language, which means that you can write various applications in it, i.e. web applications, desktop applications (Windows applications), mobile applications (phone applications) and even games.
-You can write web applications using the ASP.NET framework. I recommend starting with Blazor and ASP.NET Core or ASP.NET MVC.
-You can write desktop applications in Windows Forms, WPF and UWP. If you want to create desktop applications, I recommend writing them in WPF (using the MVVM pattern).
-Thanks to Xamarin, it is possible to create cross-platform mobile applications, including for Android and iOS.
-You can create games in Unity.
-Console applications.


Summary:


In short, C# is a popular, high-level, object-oriented programming language that runs on the .NET platform. Both C# and .NET were created by Microsoft and can be used to write various types of applications: web applications, desktop applications, mobile applications, console applications and games. In the near future, there will be articles mainly related to C#/.NET on the blog, so I think it's worth starting with this topic. I hope that I managed to explain to you what exactly C# and .NET are and you will know what environment is the most popular for such programmers, and what applications you can create.

Author of the article:
Kazimierz Szpin

KAZIMIERZ SZPIN
Software Developer C#/.NET, Freelancer. Specializes in ASP.NET Core, ASP.NET MVC, ASP.NET Web API, Blazor, WPF and Windows Forms.
Author of the blog CodeWithKazik.com

Previous article - 40 Visual Studio Keyboard Shortcuts Every Programmer Should Know
Next article - SOLID - SRP - Everything You Should Know About the Single Responsibility Principle
Comments (1)
Kazimierz Szpin
KAZIMIERZ SZPIN, czwartek, 11 lipca 2024 11:06
What do you think about this article? I'm curious about your opinion.
Dodaj komentarz

Search engine

© Copyright 2024 CodeWithKazik.com. All rights reserved. Privacy policy.
Design by Code With Kazik