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
| void Main() | |
| { | |
| using(var kernel = new StandardKernel(new CarModule())) | |
| { | |
| kernel.Load<FuncModule>(); // for sake of LinqPAD | |
| var factory = kernel.Get<ICarFactory>(); | |
| Assert.That(factory, Is.Not.Null); | |
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
| def foo(x: int = 3, y: MyType = None) -> float: | |
| pass | |
| class MyType: | |
| pass | |
| foo_y_annotation = foo.__annotations__['y'] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| void Main() | |
| { | |
| // create kernel with conventions | |
| using(var kernel = InitializeKernel()) | |
| { | |
| var backend = kernel.Get<IBackend>(); | |
| Assert.That(backend, Is.Not.InstanceOfType(typeof(ProdBackend)) | |
| .And.InstanceOfType(typeof(TestBackend))); | |
| } |
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
| Write-Host 'throw' | |
| try | |
| { | |
| try | |
| { | |
| throw "exception" | |
| } | |
| catch | |
| { |
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
| #time "on" | |
| #load "Bootstrap.fsx" | |
| open System | |
| open Akka.Actor | |
| open Akka.Configuration | |
| open Akka.FSharp | |
| open Akka.TestKit | |
| // #Using Actor |
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
| void Main() | |
| { | |
| using(var kernel = new StandardKernel(new Module())) | |
| { | |
| kernel.Load<FuncModule>(); // for sake of LinqPAD | |
| var instance1 = kernel.Get<MyClass>(new ConstructorArgument("myArg", "test")); | |
| var instance2 = kernel.Get<MyClass>(new ConstructorArgument("myArg", "test")); | |
| Assert.That(instance1, Is.Not.Null.And.SameAs(instance2)); |
NewerOlder