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
{ | |
"version": "1.0.0-*", | |
"buildOptions": { | |
"emitEntryPoint": true | |
}, | |
"dependencies": { | |
"Microsoft.NETCore.App": { | |
// delete this line: "type": "platform", | |
"version": "1.0.0-rc2-*" | |
} |
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 CreateInstanceGeneric(Type source, Type[] typeArguments, params object[] args) | |
{ | |
object result = null; | |
Type genericType = source.MakeGenericType(typeArguments); | |
try | |
{ | |
result = Activator.CreateInstance(genericType, args); | |
} |
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 source, params object[] args) | |
{ | |
if (source == typeof(string)) | |
{ | |
return string.Empty; | |
} | |
object result = null; | |
try |
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); | |
} |
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
<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
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
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.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.Samples | |
{ | |
public class ConstructorInjection | |
{ | |
public void Run() | |
{ | |
ICalculator calculator1 = new DefaultTaxCalculator(); | |
ICalculator calculator2 = new FoodTaxCalculator(); | |
ICalculator calculator3 = new BookTaxCalculator(); |