.NET code examples

Connect 4 game in Blazor WebAssembly

Connect 4 game in Blazor WebAssembly

Create Connect 4 using Blazor WebAssembly. This .NET Blazor Wasm demo is built up with C# and Razor components.
Tic-Tac-Toe game in Blazor WebAssembly

Tic-Tac-Toe game in Blazor WebAssembly

Create Tic-Tac-Toe (Noughts & Crosses) using Blazor WebAssembly. This Blazor Wasm demo is built up with C# and Razor components.
Run an ASP.NET Core application in a Docker container

Run an ASP.NET Core application in a Docker container

Download a code example which includes a Dockerfile to build and publish an ASP.NET Core Web API into a Docker container and run the application.
.NET 9 code example to download with its key new features

.NET 9 code example to download with its key new features

Download an ASP.NET Core application in .NET 9 and try out its key new features such as HybridCache, OpenAPI support and new LINQ methods.
C# 13 - Code examples that include all the new features

C# 13 - Code examples that include all the new features

Download C# 13 code examples which includes all the new features so you can try them out for yourself and see what has changed from previous C# versions.
SignalR hub example sending chat messages in ASP.NET Core

SignalR hub example sending chat messages in ASP.NET Core

Download a .NET SignalR example which adds a hub that sends messages to clients when one is connected and when a method is invoked.
Geolocation & IP lookup example to find client's location

Geolocation & IP lookup example to find client's location

A Geolocation code example in ASP.NET Core which uses IP lookup to find the client's location so you know which country they are located.
Stripe .NET checkout example to add online payments

Stripe .NET checkout example to add online payments

Download an ASP.NET Core Stripe checkout example that uses the Stripe.net NuGet package to take online payments through a Web API endpoint.
xUnit project example for unit testing in .NET and C#

xUnit project example for unit testing in .NET and C#

Download an xUnit test project to help you unit test your C# code in a .NET project. It includes Fact and Theory examples alongside different Assert methods.
Using Moq in an xUnit project to unit test a .NET project

Using Moq in an xUnit project to unit test a .NET project

Download an xUnit and a .NET class library project that uses the Moq mocking framework to mock objects as part of unit tests.