Skip to content

You are viewing a free preview of this lesson.

Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.

What is C#

What is C#

C# (pronounced "C sharp") is a modern, object-oriented programming language developed by Microsoft. It is the flagship language of the .NET ecosystem and is used for building everything from desktop applications to cloud services, games, and mobile apps.


A Brief History

  • 2000 — Anders Hejlsberg leads the design of C# at Microsoft
  • 2002 — C# 1.0 released with .NET Framework 1.0
  • 2005 — C# 2.0 introduces generics, nullable types, and iterators
  • 2007 — C# 3.0 adds LINQ, lambda expressions, and anonymous types
  • 2010 — C# 4.0 brings dynamic binding and named/optional arguments
  • 2012 — C# 5.0 introduces async/await for asynchronous programming
  • 2015 — C# 6.0 adds string interpolation, expression-bodied members, and null-conditional operators
  • 2017 — C# 7.x adds tuples, pattern matching, and local functions
  • 2019 — C# 8.0 introduces nullable reference types and async streams
  • 2020 — C# 9.0 adds records and top-level statements
  • 2021 — C# 10 adds global usings and file-scoped namespaces
  • 2022 — C# 11 adds raw string literals and generic math
  • 2023 — C# 12 adds primary constructors and collection expressions
  • Today — C# continues to evolve with annual releases alongside .NET

C# was originally designed as a language for the .NET Framework on Windows, but with the introduction of .NET Core (now simply .NET), it became a cross-platform language running on Windows, macOS, and Linux.


The .NET Ecosystem

C# runs on the .NET runtime, which provides a managed execution environment:

Component Description
.NET SDK Tools for building, running, and publishing .NET applications
CLR (Common Language Runtime) The virtual machine that executes .NET code
BCL (Base Class Library) Standard library with thousands of built-in types
NuGet Package manager for .NET (like npm for JavaScript)
MSBuild Build system for compiling and packaging projects

.NET Versions

Generation Description
.NET Framework Windows-only, original runtime (1.0–4.8)
.NET Core Cross-platform rewrite (1.0–3.1)
.NET 5+ Unified platform — the future of .NET

Tip: New projects should always target .NET 8 (LTS) or later. The .NET Framework is in maintenance mode.


What Can You Build with C#?

C# is an incredibly versatile language:

Application Type Framework / Technology
Web APIs ASP.NET Core
Web Applications ASP.NET Core MVC, Razor Pages, Blazor
Desktop (Windows) WPF, WinForms, WinUI, MAUI
Mobile .NET MAUI (iOS, Android)
Games Unity (the world's most popular game engine)
Cloud / Microservices ASP.NET Core, Azure Functions, gRPC
IoT .NET IoT Libraries
Machine Learning ML.NET
Console Tools .NET Console Applications

How C# Compares

Feature C# Java Python TypeScript
Typing Static, strong Static, strong Dynamic, strong Static, strong
Platform .NET (cross-platform) JVM (cross-platform) CPython Node.js / Browser
Performance High (compiled + JIT) High (compiled + JIT) Moderate (interpreted) Moderate
Primary use Enterprise, games, web Enterprise, Android Data science, scripting Web front-end
Null safety Nullable reference types Optional, limited No Strict null checks
Async model async/await (built-in) CompletableFuture asyncio async/await

Key Language Features

C# is a multi-paradigm language supporting:

Object-Oriented Programming

  • Classes, interfaces, inheritance, polymorphism
  • Properties, indexers, events, delegates

Functional Programming

  • Lambda expressions and LINQ
  • Pattern matching and switch expressions
  • Immutable records and tuples

Modern Safety Features

  • Nullable reference types (compile-time null safety)
  • Span and Memory for safe, high-performance memory access
  • Range and index operators

Performance

  • Value types (structs) for stack allocation
  • ref structs and Span for zero-allocation patterns
  • Hardware intrinsics for SIMD operations

Your First C# Program

// Hello World in modern C# (top-level statements)
Console.WriteLine("Hello, World!");

Or with the traditional structure:

namespace HelloWorld;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
    }
}

Summary

C# is a powerful, modern programming language backed by Microsoft and a vibrant open-source community. It runs on the cross-platform .NET runtime and is used for web, desktop, mobile, games, cloud, and more. In the following lessons, we will set up a development environment and begin exploring C#'s syntax and features in detail.