二進制文件和源代碼可以從這里下載到:
http://naive.container.googlepages.com/home
存在的意義:
最簡單原始的組件裝配
使用:
public class Susan : ContainerBound
{
public void FallInLove()
{
Console.WriteLine("Susan has fallen in love with " + Get<Boy>().Name);
}
}
public class Lily : ContainerBound
{
public void Kiss()
{
Console.WriteLine("Lily is kissing {0}", Get<Boy>().Name);
}
}
public class Lucy : ContainerBound
{
public void Marry()
{
Console.WriteLine("Lucy is marrying " + Get<Boy>().Name);
}
}
{
public void FallInLove()
{
Console.WriteLine("Susan has fallen in love with " + Get<Boy>().Name);
}
}
public class Lily : ContainerBound
{
public void Kiss()
{
Console.WriteLine("Lily is kissing {0}", Get<Boy>().Name);
}
}
public class Lucy : ContainerBound
{
public void Marry()
{
Console.WriteLine("Lucy is marrying " + Get<Boy>().Name);
}
}
配置:
Containers.GetContainerInContext<object>().Put(new GenericBoy("Van"));
Containers.GetContainerInContext<Lucy>().Put(new GenericBoy("Tom"));
Containers.GetContainerInContext<Lily>().Put(new GenericBoy("Joy"));
Containers.Close();
Containers.GetContainerInContext<Lucy>().Put(new GenericBoy("Tom"));
Containers.GetContainerInContext<Lily>().Put(new GenericBoy("Joy"));
Containers.Close();
更多請參見項目主頁
浙公網安備 33010602011771號