Learn C# and .NETwith code that was actually run

Tutorials on C#, ASP.NET Core, AI and cloud. Updated posts are tested on .NET 10 and .NET 11, with the real output and the exact error messages.

Popular: .NET 11 upgrade Best AI for C# EF Core errors HttpClient JWT 401

C#

The language itself, from C# 12 to C# 15: LINQ, async, generics, pattern matching, nullable reference types and testing with xUnit and Moq.

Learn C# What's new in C# 15

All 45 C# tutorials →

Program.csC# 15
public union Pet(Cat, Dog, Bird);

Pet pet = new Dog("Rex");

static string Describe(Pet pet) => pet switch
{
    Dog d => $"dog {d.Name}",
    Cat c => $"cat {c.Name}",
    Bird b => $"bird {b.Name}",
};

ASP.NET Core

Web APIs on .NET 10 that hold up in production: versioning, auth, error handling, caching, rate limiting, health checks and deployment.

Learn ASP.NET Core Build a Web API

All 46 ASP.NET Core tutorials →

Program.cs.NET 10
app.MapGet("/products/{id:int}", async (int id, IProductRepository repo, HybridCache cache, CancellationToken ct) =>
{
    var product = await cache.GetOrCreateAsync(
        $"product:{id}",
        (repo, id),
        static async (state, token) => await state.repo.GetAsync(state.id, token),
        cancellationToken: ct);

    return product is null ? Results.NotFound() : Results.Ok(product);
});

AI in .NET

AI coding tools for C# developers, and AI inside your app: agents with tools, MCP servers, LLM calls, ML.NET and TorchSharp.

Learn AI in .NET Best AI for C#

All 23 AI in .NET tutorials →

Program.csAgent Framework
AIAgent agent = chatClient.AsAIAgent(
    instructions: "You answer order questions.",
    tools: [AIFunctionFactory.Create(OrderTools.GetOrderStatus)]);
var response = await agent.RunAsync("Where is order 1042?");
Output
[model call 1] 1 messages, tools: [GetOrderStatus]
[tool ran] GetOrderStatus(1042)
[model call 2] 3 messages, tools: [GetOrderStatus]
[model sees tool result] Order 1042: shipped
reply: Order 1042 has shipped.

Cloud

Azure, AWS and Google Cloud from C#: messaging, storage, serverless, infrastructure as code and security.

Learn Cloud AWS vs Azure vs GCP

All 20 Cloud tutorials →

Subscriptions.csPub/Sub
new Subscription
{
    SubscriptionName = subName,
    TopicAsTopicName = topicName,
    Filter = "attributes.eventType = \"OrderPlaced\""
}

Recently updated and retested

Rewritten and rerun on the current .NET release.

Show all 58 updated tutorials

Written and tested by Rajni Kavathiya

I’m a full stack developer. Every updated post says which versions it was tested on and shows the real compiler and runtime output, including the errors I hit along the way.

About me and how I test Follow on Medium