.NET code examples

.NET Worker Service setup to run background tasks as a Windows Service

.NET Worker Service setup to run background tasks as a Windows Service

A .NET 6 Worker Service example running background tasks as hosted services, and setup to run as a Windows Service
.NET 7 code examples for ASP.NET Core

.NET 7 code examples for ASP.NET Core

A preview of what's new for the .NET 7 release, including code examples of ASP.NET Core features to download.
C# 11 features: Download samples

C# 11 features: Download samples

C# 11 features and sample to download. Preview the latest changes in a nutshell, and see what's new with .NET 7.
AppSettings.json example in .NET and C#

AppSettings.json example in .NET and C#

Download our appsettings.json example which focuses on how to read a value, using ConnectionString, environment and logging.
Data Annotation custom validator in ASP.NET Core

Data Annotation custom validator in ASP.NET Core

Download a Data Annotation custom validator written in C# that can be used in .NET with MVC and Web API for model validation.
A FromBody and FromQuery sample in ASP.NET Core Web API

A FromBody and FromQuery sample in ASP.NET Core Web API

An ASP.NET Core example of using the FromBody and FromQuery attribute. Handy if your request is null, or getting a 415 error.
Download a Blazor WebAssembly button onclick event example

Download a Blazor WebAssembly button onclick event example

Use a Blazor Wasm parameter to pass the onclick event to another Razor compoment and use it async. Download the code example.
Dynamic queries using LINQ expressions

Dynamic queries using LINQ expressions

Writing dynamic queries for Entity Framework. A sample .NET 5 MVC application, showing examples of LINQ expressions.
.NET 6 new features using ASP.NET Core

.NET 6 new features using ASP.NET Core

Download an ASP.NET Core 6 application that demonstrates new .NET 6 features, using C# 10 and Visual Studio 2022.
EF Core 6 new features examples for .NET 6

EF Core 6 new features examples for .NET 6

Download a EF Core 6 sample for new features. See what's new as part of the .NET 6 update, including migration bundles.