C# ยท Chapter 1 of 46

C# Introduction

C# (pronounced "C-sharp") is a modern, object-oriented programming language created by Microsoft in 2000. It runs on the .NET platform and is used to build websites, desktop apps, games, mobile apps, and cloud services.

C# combines the power of C++ with the simplicity of languages like Java. It is strongly typed, has automatic memory management (garbage collection), and is actively maintained and improved by Microsoft and the open-source community.

Why learn C#?

C# is one of the most popular programming languages in the world. It is used for web development with ASP.NET, game development with Unity, desktop apps, and much more. It has strong tooling support through Visual Studio and Visual Studio Code.

Where is C# used?

C# powers enterprise business applications, Unity games, Windows desktop software, cloud services on Azure, and cross-platform mobile apps using .NET MAUI.

Example 1 (csharp)
using System;

class Program {
  static void Main() {
    Console.WriteLine("Hello, World!");
  }
}
Output
Hello, World!

This is the classic first C# program that prints text to the console.

Example 2 (csharp)
using System;

class Program {
  static void Main() {
    Console.WriteLine("C# is fun!");
  }
}
Output
C# is fun!

Every C# console app needs a Main() method as its entry point.

Key points

  • C# was created by Microsoft in 2000.
  • C# runs on the .NET platform and is cross-platform today.
  • C# is object-oriented and strongly typed.
  • C# is used for web, desktop, games, mobile, and cloud apps.
๐Ÿ’ก Note: C# and .NET are now open-source and run on Windows, macOS, and Linux.

๐Ÿ“ Quick Quiz

1. Who created C#?

2. C# runs on which platform?

3. Which is NOT a common use of C#?