C# (pronounced “C sharp”) is Microsoft’s free, general-purpose programming language for building web apps, APIs, cloud services, desktop apps and Unity games. You write C#, and the .NET platform compiles and runs it on Windows, macOS and Linux.
In this tutorial, I’ll explain what is C# in plain English, then have you write and run your first program with the .NET 10 SDK. Then we’ll grow it one feature at a time.
What Is C#? The Language vs .NET vs Visual Studio
Beginners mix up three names, so here’s the split. C# is the language you type. .NET is the platform that runs it. Visual Studio and VS Code are just editors.
| Name | What it is | You use it to |
|---|---|---|
| C# | Programming language (C# 14 is current) | Write the code |
| .NET | Free, open-source runtime, libraries and SDK | Compile and run the code |
| Visual Studio / VS Code | IDE / code editor (VS Code + C# Dev Kit) | Edit, debug and run projects |
C# is strongly typed and object-oriented, with a garbage collector that frees memory for you. Its syntax looks like Java or JavaScript: semicolons, curly braces, if, for and switch statements in C#.
You’ll still hear “C#.NET” in job posts. It isn’t a separate language, just C# used with .NET.
What Is C# Used For in 2026?
Almost everything, and Blazor even covers browser UI. Here’s where I see C# used most:
| You want to build | C# / .NET tool |
|---|---|
| Web apps and REST APIs | ASP.NET Core (MVC, Razor Pages, minimal APIs) |
| Interactive web UI in C# | Blazor |
| Cloud services | Azure SDK for .NET, Worker Services, Aspire |
| Desktop and mobile apps | WinForms, WPF, .NET MAUI |
| Games | Unity, MonoGame |
| AI apps | Microsoft Agent Framework, ML.NET |
Current Versions: C# 14 and .NET 10 (LTS)
C# 14 shipped in November 2025 and is supported on .NET 10. .NET 10 is a Long Term Support release, released November 11, 2025 and supported until November 14, 2028.
LTS releases get three years of free patches; Standard Term Support releases get two. Both .NET 8 and .NET 9 reach end of support on November 10, 2026, so start new projects on .NET 10.
A Short History of the C# Language
C# was developed inside Microsoft; its principal inventors were Anders Hejlsberg, Scott Wiltamuth and Peter Golde. C# 1.0 shipped in January 2002 with Visual Studio .NET 2002, and Ecma standardized it as ECMA-334.
Later milestones: generics and anonymous methods in C# 2.0, LINQ in 3.0, async in 5.0 and records in 9.0. A new version now ships every November.
Write Your First C# Program on .NET 10
You don’t need a project file anymore: .NET 10 runs a single .cs file directly.
- Install the .NET 10 SDK and check it with
dotnet --version(mine printed10.0.402). - Add VS Code and the C# Dev Kit; here’s how to download and install Visual Studio Code.
- Save the code below as
Hello.csand rundotnet run Hello.cs.
// Hello.cs - my first C# program
string name = "Jenna";
Console.WriteLine($"Hello, {name}!");
Console.WriteLine($"Running on .NET {Environment.Version}");
Output:
Hello, Jenna!
Running on .NET 10.0.13

There’s no Main method or class here. Top-level statements let you start with the code itself, and $"..." drops values into a string.
When your code outgrows one file, run dotnet new console to get a project. I cover that in creating a console application in VS Code.
Key C# Language Features, Step by Step
Now let’s grow that first program. Each step is another small file in the same folder, run the same way.
Step 1: Types and var
Every variable in C# has a type the compiler knows before the program runs. var just lets the compiler figure it out:
using System.Globalization;
CultureInfo.CurrentCulture = new CultureInfo("en-US");
string city = "Austin"; // text
int orders = 42; // whole number
decimal total = 1249.50m; // money: use decimal
var state = "TX"; // the compiler infers string
Console.WriteLine($"{city}, {state}: {orders} orders, {total:C}");
Console.WriteLine($"state is a {state.GetType().Name}");
Output:
Austin, TX: 42 orders, $1,249.50
state is a String
Assign a number to that string, and the build fails before anything runs:
var state = "TX";
state = 5; // a string variable can't hold an int
Build error:
C:\DotNetDemo\WhatIsCSharpDemo\TypeError.cs(2,9): error CS0029: Cannot implicitly convert type 'int' to 'string'
That early error is a big reason teams like C#. For the full list of types, see data types in C# and variables in C#.
Step 2: Classes and Records
A class bundles data with behavior. A record is a short way to declare data that compares by value and prints nicely:
var jenna = new Customer("Jenna Moore", "Seattle", "WA");
var moved = jenna with { City = "Spokane" }; // copy with one change
Console.WriteLine(moved);
Console.WriteLine($"Same data? {jenna == new Customer("Jenna Moore", "Seattle", "WA")}");
var cart = new Cart();
cart.Add(3);
Console.WriteLine($"Cart has {cart.Items} items");
// record: data with value equality and a readable ToString
record Customer(string Name, string City, string State);
// class: data + behavior
class Cart
{
public int Items { get; private set; }
public void Add(int quantity) => Items += quantity;
}
Output:
Customer { Name = Jenna Moore, City = Spokane, State = WA }
Same data? True
Cart has 3 items

Notice jenna == new Customer(...) is True because the data matches. Classes, inheritance and interfaces are covered in my OOP concepts in C# guide.
Step 3: LINQ Queries
LINQ lets you filter, group and sum a collection in a few readable lines instead of nested loops. Here I total sales by US state:
using System.Globalization;
CultureInfo.CurrentCulture = new CultureInfo("en-US");
List<Sale> sales =
[
new("Ryan Carter", "TX", 1200m), new("Chloe Brady", "CA", 950m),
new("Jenna Moore", "WA", 1430m), new("Zoe Ng", "TX", 610m),
new("Ethan Rodriguez", "CA", 2075m),
];
var byState = sales.GroupBy(s => s.State)
.Select(g => new { State = g.Key, Total = g.Sum(s => s.Amount) })
.OrderByDescending(x => x.Total);
foreach (var row in byState)
Console.WriteLine($"{row.State}: {row.Total:C0}");
Console.WriteLine($"Top rep: {sales.MaxBy(s => s.Amount)!.Rep}");
record Sale(string Rep, string State, decimal Amount);
Output:
CA: $3,025
TX: $1,810
WA: $1,430
Top rep: Ethan Rodriguez

The same methods work on arrays and lists. My guides to C# arrays and List in C# go deeper.
Step 4: async and await
Web apps spend most of their time waiting on databases and APIs. async and await wait without blocking a thread:
string[] results = await Task.WhenAll(
CheckStockAsync("Seattle", 300),
CheckStockAsync("Denver", 200),
CheckStockAsync("Boston", 100));
foreach (string line in results) Console.WriteLine(line);
static async Task<string> CheckStockAsync(string store, int delayMs)
{
await Task.Delay(delayMs); // stands in for a web call
return $"{store}: in stock";
}
Output:
Seattle: in stock
Denver: in stock
Boston: in stock
The three checks run at the same time, and WhenAll returns the results in the order you started them.
Step 5: Pattern Matching
A switch expression picks a result by the shape of the data. This one prices shipping by state and weight:
var parcels = new[] { ("TX", 2), ("CA", 12), ("AK", 4), ("NY", 0) };
foreach (var (state, pounds) in parcels)
Console.WriteLine($"{state} {pounds,2} lb -> {Ship(state, pounds)}");
static string Ship(string state, int pounds) => (state, pounds) switch
{
(_, <= 0) => "invalid weight",
("AK" or "HI", _) => "air, $24.99",
(_, > 10) => "freight, $14.99",
_ => "ground, $5.99",
};
Output:
TX 2 lb -> ground, $5.99
CA 12 lb -> freight, $14.99
AK 4 lb -> air, $24.99
NY 0 lb -> invalid weight

What’s New in C# 14?
C# 14 adds extension members, the field keyword, null-conditional assignment, implicit span conversions and more. Here are three you’ll use early:
var order = new Order { Zip = " 98101 " };
Console.WriteLine($"Zip: '{order.Zip}'");
Console.WriteLine($"Blank note? {" ".IsBlank}");
Order? missing = null;
missing?.Zip = "10001"; // C# 14: skipped because missing is null
Console.WriteLine($"Still null: {missing is null}");
class Order
{
// C# 14: 'field' is the compiler-made backing field
public string Zip { get; set => field = value.Trim(); } = "";
}
static class TextExtensions
{
extension(string text) // C# 14: extension members
{
public bool IsBlank => string.IsNullOrWhiteSpace(text);
}
}
Output:
Zip: '98101'
Blank note? True
Still null: True

field trimmed the zip code without a hand-written backing field, and IsBlank is an extension property. C# 14 also allows partial constructors, which pairs with partial classes in C#.
C# vs Java vs Python vs JavaScript: Which Language?
All four are good choices. Here’s how I’d compare them for a beginner:
| C# | Java | Python | JavaScript | |
|---|---|---|---|---|
| Typing | Static | Static | Dynamic | Dynamic (TypeScript adds static) |
| Runs on | .NET | JVM | Interpreter | Browser, Node.js |
| Strongest at | Web APIs, Azure, desktop, Unity | Enterprise back ends, Android | Data, AI, scripting | Front-end web |
If you know Java, C# will feel familiar within a week. From Python, static types take some getting used to.
Why Do Companies Use .NET for Web Applications?
Here are the reasons that still hold up in 2026, checked against Microsoft’s docs:
- Free and open source: .NET is MIT-licensed and a .NET Foundation project, with no license fee.
- Cross-platform: one ASP.NET Core app runs on Windows, Linux and macOS.
- Several languages: C#, F# and Visual Basic all run on .NET.
- Libraries and support: NuGet packages save code, and patches ship monthly on Patch Tuesday.
One correction to older articles: Code Access Security isn’t supported on modern .NET. Use OS boundaries like containers instead.
Interviewers ask about this, so read my .NET Core interview questions and answers.
Is C# a Good Language to Learn for a US Job?
I think so, especially if you’re targeting companies that run on Azure. Banks, insurers, healthcare, government contractors and game studios all hire C# developers.
Job titles to search include .NET developer, C# developer, ASP.NET Core developer and Unity developer. Before interviews, practice with these C# interview questions for freshers.
Your C# Learning Path: Where to Go Next
Write a tiny program every day for two weeks, then pick one workload, usually ASP.NET Core. Every tutorial I’ve written lives in the C# .NET tutorials section.
Ready for the next step? These four fill in the basics:
- Loop through data with the for loop
- Store key-value pairs in a Dictionary
- Define contracts with interfaces
- Write reusable methods in C#
Frequently Asked Questions
Is C# the same as .NET?
No. C# is a programming language; .NET is the platform (runtime, libraries and SDK) that compiles and runs it. .NET also runs F# and Visual Basic.
Is C# hard to learn for beginners?
Not really. Top-level statements and file-based apps mean your first program is one line in one file, and the compiler points out type mistakes before the code runs.
What is the latest version of C#?
C# 14, released in November 2025 with .NET 10. Microsoft lists every feature on What’s new in C# 14.
How long is .NET 10 supported?
Until November 14, 2028. It’s an LTS release, so it gets three years of free patches, per the .NET support policy.
Is C# free to use?
Yes. The .NET SDK, the C# compiler and VS Code are free, and .NET is open source under the MIT license.
Bijay Kumar is a renowned software engineer, accomplished author, and distinguished Microsoft Most Valuable Professional (MVP) specializing in SharePoint. With a rich professional background spanning over 15 years, Bijay has established himself as an authority in the field of information technology. He possesses unparalleled expertise in multiple programming languages and technologies such as ASP.NET, ASP.NET MVC, C#.NET, and SharePoint, which has enabled him to develop innovative and cutting-edge solutions for clients across the globe. Read more…