I am studying Asp.NET Core 3.1.
Noticed that when we started the project. It will go to the ConfigureServices and inject a service.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
}
My question is why services can use those extension methods?
I checked the framework.
IServiceCollection is an interface. There is the properties called Services in IMvcBuilder interface.
but still don't understand what the relationship is.
How .NET knows IServiceCollection services can use the extension methods such as AddControllersWithViews(), AddMvc()...etc ?
Thanks.