- Home
- .NET code examples
- .NET 9 code example to download with its key new features
.NET 9 code example to download with its key new features
The .NET 9 release has seen a number of new features and you can download the code example to try them out for yourself.
Software
This is the software that will need to be installed onto your machine.
- Visual Studio 2022. Version 17.12.0 or above. It will work with the free community version.
- .NET 9 SDK. Version 9.0.0 or above.
Get the application working
You'll need to fill out the code example form. We will send you an email where you can download the code example.
Open up RoundTheCode.DotNet9NewFeatures.sln
in Visual Studio 2022 and run the ASP.NET Core application which will be hosted on https://localhost:9992
.
C# coding challenges
This is how you can try out the new features:
New LINQ methods
Run either https://localhost:9992/api/linq/count-by
, https://localhost:9992/api/linq/aggregate-by
or https://localhost:9992/api/linq/index
to test out the new LINQ methods.
Minimal API updates
Run https://localhost:9992/server-error
to see the new InternalServerError
method in the TypedResults
static class.
The OpenAPI documentation that is produced when using ProducesProblem
and ProducesValidationProblem
can be viewed at https://localhost:9992/openapi/v1.json
.
Developer exception page improvements
To see the new Endpoint Metadata section in the Routing tab on the developer exception page, run https://localhost:9992/api/error/error
.
Keyed service support for middleware
Open up Middleware/MyMiddleware.cs
to see keyed services being injected into a middleware class through the constructor and the Invoke
method.
Static asset delivery optimisation
Publish the ASP.NET Core application and the publish folder will contain Gzip files .gz
and Brotli .br
files for the CSS and JavaScript files in the wwwroot
folder.
OpenAPI document generation support
Load https://localhost:9992/openapi/v1.json
to view the OpenAPI document with all the controller and Minimal API endpoints.
New HybridCache
library
Run the https://localhost:9992/api/cache
endpoint which uses the HybridCache
library to cache the HTTP response from an external API call.
More information
Watch our .NET 9 new features video where you can see these new features and how they work.
And you can read our .NET 9 new features tutorial with explanations and examples of how each of them work.