This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YouCanHackIt.ArchitectureDesign.DI.Samples | |
{ | |
public class ConstructorInjection | |
{ | |
public void Run() | |
{ | |
ICalculator calculator1 = new DefaultTaxCalculator(); | |
ICalculator calculator2 = new FoodTaxCalculator(); | |
ICalculator calculator3 = new BookTaxCalculator(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YouCanHackIt.ArchitectureDesign.DI.Samples | |
{ | |
public class SetterInjection | |
{ | |
public void Run() | |
{ | |
ICalculator calculator1 = new DefaultTaxCalculator(); | |
ICalculator calculator2 = new FoodTaxCalculator(); | |
ICalculator calculator3 = new BookTaxCalculator(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YouCanHackIt.ArchitectureDesign.DI.SecondSolution | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class Implementation | |
{ | |
public void BuyProducts() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YouCanHackIt.ArchitectureDesign.DI.FirstSolution | |
{ | |
using System; | |
public class Implementation | |
{ | |
public void BuyProducts() | |
{ | |
var importedCD = new Product("imported CD", 10.99m, false, true); | |
var perfume = new Product("perfume", 19.99m, false, false); |
NewerOlder