This file contains 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); |
This file contains 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 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 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 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.ThirdSolution | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class Implementation | |
{ | |
public void BuyProducts() | |
{ |
This file contains 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.MEFSolution | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.Composition; | |
using System.ComponentModel.Composition.Hosting; | |
using System.Linq; | |
using System.Reflection; | |
public class Implementation |
This file contains 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.DevLibSolution | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using DevLib.Ioc; | |
public class Implementation | |
{ |
This file contains 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
<sdk:sdk-addon> | |
<sdk:add-on> | |
<sdk:revision>18</sdk:revision> | |
<sdk:archives> | |
<sdk:archive> | |
<sdk:size>224779548</sdk:size> | |
<sdk:checksum type="sha1">E2B81A62720BB1735C0B4CD8CEF5D861FFF9CEE9</sdk:checksum> | |
<sdk:url>addon-google_apis_x86-google-19.zip</sdk:url> | |
</sdk:archive> | |
</sdk:archives> |
This file contains 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
public static object CreateInstance(Type type) | |
{ | |
return type.GetConstructor(new Type[] { }).Invoke(new object[] { }); | |
} |
This file contains 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
public static object CreateInstance(Type type) | |
{ | |
return Activator.CreateInstance(type); | |
} |
OlderNewer