vendredi 8 mai 2020

Question about C# Pattern in ASP.NET Core When Adding Services in Startup.cs

With regards to this code to configure services:

public void ConfigureServices(IServiceCollection services)
{
    services.AddSingleton<IDb, Db>();
    services.AddControllers();
}

and specifically the line:

services.AddSingleton<IDb, Db>();

would there be any semantic difference if AddSingleton, instead of being a generic function with 0 parameters as in the code snippet, was instead

AddSingleton(Type type1, Type type2);

Aucun commentaire:

Enregistrer un commentaire