Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
C# is a statically typed, object-oriented language that Microsoft released in 2000, designed by Anders Hejlsberg to pair familiar C-family syntax with the managed .NET runtime. It has since grown into a multi-paradigm language with generics, LINQ, async/await, pattern matching, and nullable reference types. Today it powers Unity games, ASP.NET Core web APIs, Windows desktop apps built with WPF or WinForms, and large enterprise back ends across banking and government. On XCODX it compiles and runs as a console program in a cloud sandbox, so you write to Console.Out and read from Console.In rather than opening a window or serving a port. The runtime and language version you get are shown in the badge above the editor.
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main()
{
var names = new List<string> { "Ada", "Linus", "Grace" };
foreach (var name in names)
Console.WriteLine($"Hello, {name}!");
int[] nums = { 4, 8, 15, 16, 23, 42 };
Console.WriteLine($"Sum: {nums.Sum()}, Max: {nums.Max()}");
}
}
C#'s strengths are a large, well-documented Base Class Library, strong static typing softened by modern conveniences like LINQ and async/await, and a mature tooling story on .NET. Reach for it when you are building ASP.NET web APIs, Unity games, cross-platform apps with .NET MAUI, or Windows desktop software and you want compile-time safety without manual memory management. It is a poor fit for tiny throwaway shell-style scripts, where its ceremony of classes, types, and a build step is heavier than reaching for Python or Bash. In this sandbox it shines for practicing console logic, algorithms, and BCL features rather than the GUI and web scenarios it is known for in production.
No. XCODX runs your C# in a cloud sandbox with no package manager and no network, so NuGet, dotnet add package, and dotnet restore are all unavailable. You still get the full .NET Base Class Library (BCL) - System, System.Linq, System.Collections.Generic, System.Text and so on - but no third-party libraries. If your code depends on an external NuGet package, it will not compile here.
Console.ReadLine() reads one line from standard input and returns it as a string, so numeric input must be parsed with int.TryParse or Convert.ToInt32. The compiler gives you a live interactive terminal that streams what you type, or a Stdin Box where you paste all input up front before running. ReadLine blocks while it waits for a line and returns null once the input stream ends, which you signal with Ctrl+D.
The runtime and language version are shown in the version badge above the editor; depending on the build it runs on Mono or on .NET. Your code always executes as a console program, and there is no local SDK to install or configure. Newer language features can be tied to a newer compiler, so treat the badge as the source of truth for what will actually compile.
Every C# console program needs exactly one entry point. The most portable form here is a class with a static void Main() method (optionally static void Main(string[] args)), which compiles on both Mono and .NET. Top-level statements without a visible Main are only supported on newer .NET-based runtimes, so if you hit this error, wrap your code in a class with an explicit Main.
No. The sandbox only runs console applications, so there is no window, no GUI toolkit, and no way to bind to a port for a web server. There is also no network access, so ASP.NET endpoints, HttpClient calls, and database connections will not work. Use it for console logic, algorithms, and Base Class Library features rather than desktop or web front ends.
Yes. 'Standard library only' still means the full .NET Base Class Library, so LINQ (System.Linq), generic collections, string and text handling, regular expressions, dates, math, and threading are all available once you add the matching using directive. Only third-party NuGet packages and anything that needs the network or a file that survives between runs are off the table.
main.cstext/x-csharpConsole.ReadLine()using System;
class Program {
static void Main() {
Console.WriteLine("Hello from C#!");
Console.WriteLine("Welcome to XCODX Online Compiler!");
}
}
Compiler banner lines from the .NET SDK (restore progress, build summary, elapsed time) are stripped so the pane shows program output only.