Introduction to C#

Learn about Microsoft's high-level language known as C#.

C# (pronounced “C Sharp”) is a modern, easy-to-use, object-oriented programming language developed by the Microsoft Corporation. The first version of C# was released in 2002, and the latest version (10.0) was released in November 2021. C# is the most popular language used in Microsoft’s Visual Studio platform.

Components of C#

C# uses the .NET Platform, which contains all components needed to run an application. One component is the CLRCommon Language Runtime. The CLR handles various tasks, such as compiling code to 1s and 0s (binary) for the computer to understand.

Also within the .NET Platform is the new .NET 6 framework that contains developers’ shared code libraries when developing applications. This means that developers needn’t write new code from scratch.

For example, there’s already a built-in class for applications that read information from a text file, so there’s no need to recreate it.

An additional benefit to using C# is its versatility. C# is a general-purpose language, meaning that it can be used to create many kinds of applications.

Examples of C# applications

Listed below are a few examples of apps created using the C# language.

  • Console Applications: A console application is a text-based application that contains no graphical components like, buttons or images. This course focuses on text-based applications because they exemplify C# simply and clearly.

  • Websites: Dynamic websites can be built using C# and ASP.NET in Visual Studio.

  • Mobile Applications: iOS and Android applications can be created quickly using C# and .NET MAUI in Visual Studio.

  • Games: Unity is a separate (free) software program used to design 2D, 3D, virtual, and mixed reality games. While the Unity GameEngine is used to design the game, the coding is still developed in Visual Studio with C#.

  • Computer Software: Software for Windows can be created using WPF, Windows Forms, or .NET MAUI.

Hello World in C#

When learning a new programming language, it’s tradition to display “Hello, World!” on the screen.

Console.WriteLine("Hello, World!");
//Output: Hello, World!

Note: There’s no explanation about the coding provided here, simply the instructions to produce the desired results. This is the only example in this course where this is true.