现在的位置: 首页 > 综合 > 正文

Naive Container 发布1.0版本

2011年07月15日 ⁄ 综合 ⁄ 共 810字 ⁄ 字号 评论关闭
二进制文件和源代码可以从这里下载到:
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);
        }
    }

配置:

Containers.GetContainerInContext<object>().Put(new GenericBoy("Van"));

Containers.GetContainerInContext<Lucy>().Put(new GenericBoy("Tom"));

Containers.GetContainerInContext<Lily>().Put(new GenericBoy("Joy"));

Containers.Close();

更多请参见项目主页

抱歉!评论已关闭.