二进制文件和源代码可以从这里下载到:
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();
更多请参见项目主页