Remove a service in ASP.Net Core Dependency Injection : <p>In an Asp.Net MVC Core (early versions, versions 1.0 or 1.1), dependency injection bindings are configured as follow in the Startup.cs class :</p>

<pre><code>public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddScoped&lt;IMyService, MyService&gt;();
        // ...
    }
}
</code></pre>

<p>In my applications, I usually have a base Startup class, where generic bindings are defined as a sequence of these lines :</p>

<pre><code>public abstract class BaseStartup
{
    public virtual void ConfigureServices(IServiceCollection services)
    {
        services.AddScoped&lt;IMyService1, MyService1&gt;();
        services.AddScoped&lt;IMyService2, MyService2&gt;();
    }
}
</code></pre>

<p>Then in my application, I inherit the startup class, and inject other services as well :</p>

<pre><code>public class Startup : BaseStartup
{
    public override void ConfigureServices(IServiceCollection services)
    {
        base.ConfigureServices(services);

        services.AddScoped&lt;IMyService3, MyService3&gt;();
        services.AddScoped&lt;IMyService4, MyService4&gt;();
    }
}
</code></pre>

<p>I now wonder : how can I kind of 'override' a previous binding ?
I would like, for instance, to either remove, or modify a binding defined in the base class, like :</p>

<pre><code>services.Remove&lt;IMyService1&gt;(); // Doesn't exist
services.AddScoped&lt;IMyService1, MyBetterService1&gt;();
</code></pre>

<p>Or simply update the binding :</p>

<pre><code>services.AddScoped&lt;IMyService1, MyBetterService1&gt;(replacePreviousBinding: true); // Doesn't exist either !
</code></pre>

<p>Is there a way to do that ? Or maybe simply declaring a new binding with the same interface as a previously defined binding will override that binding ?</p>
