示例#1
0
 // I can inject any service that is registered with dependency injection
 public DoSomethingElseService(DoSomethingService doSomethingService)
 {
     this.doSomethingService = doSomethingService;
 }
示例#2
0
 // This is called 'Constructor Injection' and it's the most common way of injecting services, you will see and use this A LOT'
 public App(DoSomethingService doSomethingService, IDoSomethingElseService doSomethingElseService)
 {
     this.doSomethingService     = doSomethingService;
     this.doSomethingElseService = doSomethingElseService;
 }