✅ Using Options pattern in MAUI

I'm trying to squeeze some Options pattern config into my MAUI app, in MauiProgram, like this:
var builder = MauiApp.CreateBuilder();
builder
    .UseMauiApp<App>()
    .UseMauiCommunityToolkit()
    .ConfigureFonts(fonts =>
    {
        fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
        fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
    });
builder.Services.Configure<MobileQuizzOptions>(builder.Configuration.GetSection(MobileQuizzOptions.ConfigurationName));

Yet I get an error that says,
Argument type 'Microsoft.Extensions.Configuration.IConfigurationSection' is not assignable to parameter type 'System.Action<Smart.Mobile.Config.MobileQuizzOptions>'

My MobileQuizzOptions class is defined in another project but the import is fine. I've not used this pattern for over two years and am a bit rusty, but three guides have suggested to do it like above. Maybe they are out of date for .NET 8?
Was this page helpful?