Write and run C# code directly in your browser with this free online compiler. C# is a modern, type-safe language developed by Microsoft, widely used for building Windows applications, web services with ASP.NET, and games with Unity. This compiler lets you execute C# programs instantly without installing Visual Studio or the .NET SDK.
C# is a modern, object-oriented programming language developed by Microsoft under the leadership of Anders Hejlsberg in 2000. It runs on the .NET runtime and combines the power of C++ with the simplicity of Visual Basic. C# has evolved significantly over the years, adding features like LINQ, async/await, pattern matching, records, and top-level statements. It is the primary language for .NET development, including ASP.NET web applications, MAUI cross-platform apps, and Unity game development.
using System;
using System.Collections.Generic;
// Class definition
class Developer {
public string Name { get; set; }
public Developer(string name) => Name = name;
public void Greet() => Console.WriteLine($"Welcome, {Name}!");
}
class Program {
static void Main() {
// Variables
string site = "LabsICT";
int year = 2025;
// Collections and loop
var languages = new List<string> { "C#", "Python", "Java" };
foreach (var lang in languages) {
Console.WriteLine($"Learn {lang} at {site}");
}
// Object usage
var dev = new Developer("Bilal");
dev.Greet();
}
}
C# is incredibly versatile. Web developers use ASP.NET Core to build high-performance REST APIs and full-stack web applications. Game developers use Unity with C# to create 2D and 3D games for PC, console, and mobile. Desktop developers use WPF, WinForms, or MAUI to build cross-platform applications. C# is also used for cloud services with Azure, enterprise software, IoT applications, and microservices architectures.
Type your C# code in the editor and click Run. The compiler supports modern C# features including LINQ, async/await, string interpolation, and collections. Use Copy to save, Reset to restore the example, and Share to generate a link.
Continue with our C# learning track, try more online compilers, or browse tutorials for step-by-step guides.