.NET
- Pronunciation
- dot-NET
In short
.NET is Microsoft's free, open-source developer platform for building web, desktop, mobile, cloud and game applications, mainly in C#.
What is .NET?
The original .NET Framework appeared in 2002 and ran only on Windows. In 2016 Microsoft released .NET Core, a rewrite that was open source and ran on Windows, Linux and macOS. In 2020 the two lines were unified as .NET 5, and since then a new version ships every November, with even-numbered releases supported for longer as LTS versions.
Code written in C#, F# or Visual Basic compiles to an intermediate language that runs on the common language runtime (CLR), which compiles it to machine code just in time, manages memory with a garbage collector and enforces type safety. Ahead-of-time compilation is also available for fast startup and small containers.
For web work, ASP.NET Core provides minimal APIs and controllers for REST services, Razor Pages and MVC for server-rendered sites, Blazor for interactive web UIs in C#, and SignalR for real-time features. Entity Framework Core is the main ORM, and NuGet is the package manager. Beyond the web, .NET powers desktop apps, cross-platform mobile apps and many games through Unity.
A common misconception is that .NET is Windows-only and closed source. That describes the old .NET Framework, which still exists for legacy apps. Modern .NET is open source on GitHub, runs on Linux servers and in containers, and performs very well in independent benchmarks.
Key takeaways
- .NET is Microsoft's open-source platform for many kinds of apps, mainly in C#.
- .NET Core in 2016 made it cross-platform; .NET 5 in 2020 unified the line.
- Code runs on the CLR, which JIT-compiles it and manages memory.
- ASP.NET Core builds APIs and web apps; EF Core is the ORM.
- The legacy .NET Framework is Windows-only; modern .NET is not.
Example
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var books = new List<Book> { new(1, "Dune") };
app.MapGet("/books/{id:int}", (int id) =>
books.FirstOrDefault(b => b.Id == id) is { } book
? Results.Ok(book)
: Results.NotFound());
app.MapPost("/books", (Book book) =>
{
books.Add(book);
return Results.Created($"/books/{book.Id}", book);
});
app.Run();
record Book(int Id, string Title);Readers ask
What is the difference between .NET and .NET Framework?
.NET Framework is the original Windows-only version, now in maintenance mode. .NET, formerly .NET Core, is the modern, cross-platform and open-source successor, where all new development happens.
What is ASP.NET Core?
The web framework of modern .NET. It is used to build REST APIs, server-rendered websites, real-time apps and Blazor web interfaces.
Is .NET only for C#?
No. C# is by far the most used, but F# and Visual Basic also run on .NET, and all of them can use the same libraries.
See also
- C#Programming Languages, p. 4C# is a statically typed, object-oriented language that runs on the .NET runtime with garbage collection and is used for web backends, desktop apps, and games.
- F#Programming Languages, p. 11F# is a functional-first, statically typed language for .NET that pairs concise, type-inferred code with full access to the .NET ecosystem and C# libraries.
- Garbage CollectionProgramming Fundamentals, p. 23Garbage collection is automatic memory management in which the language runtime finds data a program can no longer use and frees that memory for reuse.
- REST APIBackend & APIs, p. 38A REST API is a web API that exposes data as resources identified by URLs and lets clients read or change them using standard HTTP methods.
- ORMDatabases, p. 33An ORM is a library that maps database tables to objects in your programming language, letting you read and write data with code instead of raw SQL.
- CompilerProgramming Fundamentals, p. 11A compiler is a program that translates source code written in a programming language into a lower-level form, such as machine code, that a computer can run.
- Visual BasicProgramming Languages, p. 32Visual Basic is Microsoft's family of beginner-friendly languages, including classic Visual Basic, VB.NET and VBA, which automates Office apps with macros.
Spotted a mistake or something missing on this page?Suggest an edit