SyntaxStudy
Sign Up
C# What Is C# and the .NET Platform
C# Beginner 1 min read

What Is C# and the .NET Platform

C# is a modern, statically-typed, object-oriented language developed by Microsoft and first released in 2002. It runs on the .NET runtime, which provides memory management through garbage collection, a rich standard library, and cross-platform support across Windows, Linux, and macOS since .NET Core. .NET 8, released in November 2023, is the latest Long-Term Support release and introduces performance improvements, native AOT compilation, and new APIs. Every C# program needs at least one entry point, and modern .NET supports top-level statements that remove the boilerplate class and Main method. The C# compiler (Roslyn) transforms source code into Intermediate Language (IL), which the .NET runtime's JIT compiler converts to native machine code at run time. This architecture lets a single compiled binary run unchanged on multiple operating systems and CPU architectures.
Example
// HelloWorld.cs — a minimal .NET 8 console application
// With top-level statements there is no need for a class or Main method.

using System;

Console.WriteLine("Hello, .NET 8!");

// Variables use type inference with 'var'
var language = "C#";
var version  = 12;

Console.WriteLine($"Language: {language}, Version: {version}");

// String interpolation embeds expressions directly in string literals
string name = "World";
Console.WriteLine($"Hello, {name}!");

// Verbatim strings preserve backslashes and newlines
string path = @"C:\Users\Alice\Documents";
Console.WriteLine(path);

// Raw string literals (C# 11+) need no escaping at all
string json = """
{
    "key": "value"
}
""";
Console.WriteLine(json);

// The Environment class exposes runtime information
Console.WriteLine($".NET version: {Environment.Version}");
Console.WriteLine($"OS: {Environment.OSVersion}");