public static void Main(string[] args)
IUnityContainer container = new UnityContainer();
container.RegisterType<IFoo, Foo>();
container.RegisterType<IBar, Bar>();
IFoo foo = container.Resolve<IFoo>();
IBar bar = container.Resolve<IBar>();
private readonly string Id = "87";
public void SetBar(IBar bar) {
Console.WriteLine("HeyFoo was called. My bar was " + (bar == null ? "NULL" : bar.ToString()));
public override string ToString() {
private readonly string Id = "42";
public void SetFoo(IFoo foo) {
Console.WriteLine("HeyBar was called. My foo was " + (foo == null ? "NULL" : foo.ToString()));
public override string ToString() {