.NET coding challenges

Every week, we post a number of .NET coding challenges which feature ASP.NET Core and C# interview questions for you to practice online.

Whether you are wanting to become a C# developer or looking for a new job, our exercises will help you to learn coding.

Watch the video where we answer some of the challenges:

Each challenge will feature a programming exercise for you to solve. Some are for beginners. Some are more advanced. Once you have finished with the exercise, you can reveal the answer.

Work out the number of days between two dates

Work out the number of days between two dates

Write a C# function to work out the difference between two dates and return the number of days in this coding challenge.
Removing the last character from a string

Removing the last character from a string

This coding challenge involves writing a C# method that will removing the last character from a string and returning the value.
Write a C# function to convert MPH to KPH

Write a C# function to convert MPH to KPH

Take our coding challenge to write a C# function with the necessary parameters that converts miles-per-hour (MPH) to kilometres-per-hour (KPH) and vice-versa.
Guess the SOLID principle from C# code - Part 2

Guess the SOLID principle from C# code - Part 2

The SOLID principles is a popular technical question in a .NET job interview, so take our coding challenge to see if you know which principle we are using.
How to read an appsettings.json value in ASP.NET Core

How to read an appsettings.json value in ASP.NET Core

See if you can read an appsettings.json configuration value from IConfiguration in an ASP.NET Core with our .NET coding challenge.
Add an extension method to a C# class

Add an extension method to a C# class

See if you can add a static extension method to a class and not modify the original type with our C# coding challenge
Add a hosted service to an ASP.NET Core app

Add a hosted service to an ASP.NET Core app

See if you can add a background hosted service in an ASP.NET Core app with our .NET coding challenge
Why does inheritance in a C# class not always compile?

Why does inheritance in a C# class not always compile?

A coding challenge to find out why class inheritance in C# doesn't always compile a .NET application and how to resolve it.
Initialising a C# static class won't compile

Initialising a C# static class won't compile

This coding challenge looks at initialising a C# static class in .NET and why the code will throw a compile error.
Using data annotations for Web API model validation

Using data annotations for Web API model validation

This .NET coding challenge tests how to use data annotations for model validation in an ASP.NET Core Web API endpoint by assigning them to model properties.