Master any programming language fast

The C# Programming Language

Like on Facebook
Be the first to rate this article

How is it that after 18 years from its first release, C# is suddenly, strongly rising in the TIOBE index?


C# is a computer programing language first appeared on the scene 19 years ago (2000). It is a strongly typed, object-oriented, imperative, concurrent, generic, reflective, functional and procedural programming language with automatic memory management whose main purposes have been historically two, the second of which absolutely unofficial:

  1. provide to Microsoft internal programmers as well as Microsoft client programmers a new language, coupled with a modern execution environment (.NET), as powerful as C++ to program with, but way easier, safer and secure to use and to deploy software applications with
  2. create a proprietary execution environment and programming language alternative to Java starting from the good peculiarities of that technology and extending from them without the hassle of being sued by others for not complying to specifications and requirements neither born in Microsoft nor convenient for the Microsoft monopoly of those days

Created by Anders Hejlsberg, C# was very similar to Java in the beginning, but during the years and with the release of successive versions the differences between the two languages grew more and more. Today C# and it's coupled environment .NET are widely adopted technologies with a recent further boost in their popularity given by the release in 2016 of .NET Core which is the first Microsoft fully supported version of the software framework which is free, open-source (MIT and Apache 2 licenses) and available for Windows, Mac OS X and Linux, although it still does not offer all the functionalities of the Windows only version (.NET Framework).

First glance at the code

Example: The classic "Hello world" program written in C#:

Main features of C#

Technical features

Strongly typed

C# has a type system that is checked at compile time and is more type safe than C++. For example, implicit conversions by default are only allowed when considered safe, such as widening of integers. However C# supports strongly typed implicit variable declarations with the keyword var, and implicitly typed arrays with the keyword new[] followed by a collection initializer.

C# has a unified type system called Common Type System (CTS) which means that all types, including those such as integers, are subclasses of the System.Object class. As such there is no concept of primitive data type in C#, the closest concept to it is what Microsoft call in the documentation "simple types", which belongs to the family of the Value types, in fact CTS separates data types into two main categories: Reference types and Value types. Anyway, since version the C# specification (version 4) defines keyword aliases for some types.

Table: C# simple types and their keyword aliases

Type keyword alias
System.SByte sbyte
System.Byte byte
System.Int16 short
System.UInt16 ushort
System.Int32 int
System.UInt32 uint
System.Int64 long
System.UInt64 ulong
System.Char char
System.Single float
System.Double double
System.Boolean bool
System.Decimal decimal


C# is object-oriented, but multiple inheritance is not allowed. A class can inherit characteristics and features only from a single class, but can implement more than one interface. Also classes cannot inherit from simple types as listed in the table above. In fact even if in C# every type is an Object those types are 'sealed' and cannot be derived.

Memory management

Memory management in C# is automatic. A garbage collector at run-time provides to free the memory resources allocated for the object instances that become not reachable any more by any part of the running application.


C# has complete support and offers libraries and language costructs to allow the concurrent execution of multiple threads within the same process.


C#, as a language of the .NET Framework family has access to the common language runtime and the .NET Framework classes and services that enable developers to write secure code and enable system administrators to customize the permissions granted to code so that it can access protected resources. The runtime also provides facilities to use cryptography and role-based security.


C# execution performance are those of the .NET Framework whose performance are substantially similar to those of modern Java.

Run-time support

C# applications need a .NET platform to run. Confusion often rises when trying to understand on which platform a .NET application can run. The problem is that while most of the .NET technologies and languages have been standardized and often open sourced by Microsoft, allowing even third parties to provide their own implementations of the same, some libraries, and usually exactly those that are more often used by Windows developers, are neither free and open source nor available on non Windows platforms.

Notable softwares/platforms/products written in C#

  • Stack Overflow has been developed in C#
  • Unity, one of the most adopted game engine of the world, offer the ability to script games in C#
  • Most C# and .NET developments are not from startups or open sorce projects. Wider adoption of the platform is seen in the enterprise sector for companies like banks, healtacere providers, insurance issuers and so on


.NET and C# have been created for very precise Microsoft's needings in a period when the company had the monopoly of the desktop market. Since then many things have changed in the industry and today Microsoft has not a monopoly in any sector anymore. Still .NET and C# served very well the cause of the company those days, strongly limiting the adoption of Java at least on the front-end side. While before .NET Microsoft had the obligation to provide Java on every Windows machine thanks to a contract the company signed with Java inventor Sun Microsystems, Java found itself completely outside of the desktop world when Microsoft broke the contract and started the .NET development. At the same time the world took a different path, and open source technologies like the LAMP system and other languages and technologies like PHP, Java, Python, and the internet itself decreted the end of the desktop world as we knew it and most of the personal computing migrated online leaving the desktop legacy to big companies that still had to provide interfaces to their huge internal systems for agents and employees. This is the sector in which .NET has been adopted more. Still even this sector these days is starting to migrate to HTML, CSS, JavaScript for front-end development leaving legacy desktop applications development in the past. Maybe this is why Microsoft released .NET Core which is open source and truly multiplatform and drectly supported by Microsoft itself. Trying to fit the cloud computing, the microservices arena and the docker compatibility sectors could be crucial for continuing adoption of C# and .NET in general. So far, the move seems to be paying well, in recent weeks C# is finally fiercely fighting Python in the TIOBE index.