MPDC.Container 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package MPDC.Container --version 1.0.5                
NuGet\Install-Package MPDC.Container -Version 1.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MPDC.Container" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MPDC.Container --version 1.0.5                
#r "nuget: MPDC.Container, 1.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MPDC.Container as a Cake Addin
#addin nuget:?package=MPDC.Container&version=1.0.5

// Install MPDC.Container as a Cake Tool
#tool nuget:?package=MPDC.Container&version=1.0.5                

For a sample interface IService and its implementation class SomeService:

public interface IService { int GetMillion(); }

public class SomeService : IService
{
    public int GetMillion()
    {
        return 1000000;
    }
}

We can register object instance by its abstraction: MPDCContainer.Instance.Register<IService, SomeService>(new SomeService());

If we don't want to create instance instantly, we can use overloaded method: MPDCContainer.Instance.Register<IService, SomeService>(() ⇒ new SomeService());

This will create instance of SomeService only when it is requested.

To request instance use simple Get method and pass the abstraction used to register the SomeService: MPDCContainer.Instance.Get<IService>();

var myNumber = MPDCContainer.Instance.Get<IService>().GetMillion(); //myNumber will be 1000000

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 1,434 12/7/2017
1.0.5 1,043 12/5/2017

1.0.0 public release