Last active
December 12, 2015 06:28
-
-
Save deapsquatter/4729052 to your computer and use it in GitHub Desktop.
IOC
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
interface IPullable | |
{ | |
void Pull(); | |
} | |
class Rope : IPullable | |
{ | |
public void Pull() | |
{ | |
Console.WriteLine("Pulled"); | |
} | |
} | |
public static void Main (string[] args) | |
{ | |
var ioc = IocContainer.Default; | |
Console.WriteLine("Register service = " + ioc.RegisterService(typeof(IPullable), () => new Rope())); | |
IPullable pullable = ioc.FindService<IPullable>(); | |
pullable.Pull(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment