Back to Basics — How and why learning CSharp (C#) programming language
This article is the very first of the "Back to Basics" playlist, its goal is to bring the basic knowledge to start developing with the C# language. Whether you are an experienced developer of another language such as Rust, C++, or you are a beginner looking to design applications with dotnet technologies, or even games with Unity. This playlist will be the perfect answer and information hub for beginners as well as the more experienced to lead your journey into the world of the dotnet ecosystem, and mainly in the C# language.
If you are interested in learning this new language and the huge ecosystem that is dotnet, sit down, buckle up and follow me on this fun journey!
History of C#
C# is a general-purpose, multi-paradigm programming language. C# encompasses static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.
Wikipedia
C# is pronounced "C-Sharp", it is a programming language provided by Microsoft. Anders Hejlsberg is known as the founder of C# language.
MSDN
.NET architecture
C# programs run on .NET, a virtual execution system called the common language runtime (CLR) and a set of class libraries. The CLR is the implementation by Microsoft of the common language infrastructure (CLI), an international standard. The CLI is the basis for creating execution and development environments in which languages and libraries work together seamlessly.
Source code written in C# is compiled into an intermediate language (IL) that conforms to the CLI specification. The IL code and resources, such as bitmaps and strings, are stored in an assembly, typically with an extension of .dll. An assembly contains a manifest that provides information about the assembly's types, version, and culture.
When the C# program is executed, the assembly is loaded into the CLR. The CLR performs Just-In-Time (JIT) compilation to convert the IL code to native machine instructions. The CLR provides other services related to automatic garbage collection, exception handling, and resource management. Code that's executed by the CLR is sometimes referred to as "managed code." "Unmanaged code," is compiled into native machine language that targets a specific platform.
Language interoperability is a key feature of .NET. IL code produced by the C# compiler conforms to the Common Type Specification (CTS). IL code generated from C# can interact with code that was generated from the .NET versions of F#, Visual Basic, C++. There are more than 20 other CTS-compliant languages. A single assembly may contain multiple modules written in different .NET languages. The types can reference each other as if they were written in the same language.
In addition to the run time services, .NET also includes extensive libraries. These libraries support many different workloads. They're organized into namespaces that provide a wide variety of useful functionality. The libraries include everything from file input and output to string manipulation to XML parsing, to web application frameworks to Windows Forms controls. The typical C# application uses the .NET class library extensively to handle common "plumbing" chores.
A tour of C# - Overview | Microsoft Docs
What are the advantages of learning C#
C# is a programming language called "high level" like Java, it is part of the dotnet ecosystem. In the computer science universities / university institute of technology in computer science you will surely learn this language, or Java in order to have a base in the world of development and on the object paradigm (Object Oriented Programming). You can develop applications in almost every possible field :
- whether it is in games with Unity,
- in the web with ASP.NET, Blazor.NET,
- in native applications with UWP, WinForms, WPF,
- in the world of mobile development with Xamarins,
- and now there is a framework to create a cross-platform application only through a single code base with .NET MAUI.
Whether you are on Linux, Windows or MacOS, you have no excuse to start your journey in this incredible universe.
Moreover, C#.NET has a huge community to support you during your learning, whether it is on :
IDEs and texts editors
There are a multitude of IDEs and code editors that you can use to write code in C#, nevertheless, the most popular and used are :
Whatever else you try, there are extensions everywhere that will allow you to design your dotnet powered applications in the best of comforts, although those listed below are the most recommended.
Recommended resources for learning
There are many resources to learn C#, mostly theoretical or practical, at the time of writing this article, these are the articles that make the most sense to me to learn C#, this list may be updated in the future:
- The official C#.NET documentation
- C# for beginners - 2 hours video by dotnet
- C# 101 playlist by dotnet
- Learn CSharp with CSharpFritz
- All videos to learn dotnet, MSDN
- Interactive course to learn C#
Or maybe you want to learn by doing? Zachary Patten is an associate member of the C# support community on the Discord server. You can find on his GitHub repository, examples of console games created with their renderings available on a site powered by Blazor Web Assembly. dotnet-console-games
Hello world
using System;
namespace MyApp
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Hello world in the console template
Console.WriteLine("Hello, World!");
same but with the new console template
Good mentions
Advice during your learning process
Although the resources are qualitative to allow you to learn, it is not enough to simply watch the videos and try to memorize as much information as possible. You must practice! Try to create something by yourself, create a console game, try to create a website, an application. You will most likely find yourself blocked, on the verge of collapse and abandonment, but you must not give up! Search for solutions to your problems on Google, learn how to use the search engine to find answers to your questions very quickly. Learn continuously, look for resources elsewhere, look at the codes of C# gurus, browse open-source resources, even contribute... Think before you design your application, take the time to brainstorm with paper and pen.