转载请注明出处:http://www.cnblogs.com/zhiyong-ITNote/
在基于dotnet core的web开发中,我们会经常用到DI,那么如果单单使用dotnet core自身提供的一整套DI程序,该如何来实现呢?
直接上代码吧:
public interface IBar { void MethodOne(); void MethodTwo(); } public class Bar : IBar { public void MethodOne() { Console.WriteLine("MethOne...."); } public void MethodTwo() { Console.WriteLine("MethTwo...."); } }