码迷,mamicode.com
首页 > 其他好文 > 详细

Test,使用word发布博客12332434345454654

时间:2015-11-14 20:31:05      阅读:323      评论:0      收藏:0      [点我收藏+]

标签:

Abcbokesdfklsdjlf技术分享

技术分享技术分享

11111111111111111111111111111111111111111111111111111111111111111111111

?

1111111

Uuiu

Iii

Iooo

Pppp

ppppoj

???
???
???
???
???

?

var htmlstr = "<object classid=‘clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95‘ id=‘MediaPlayer1‘ width=‘" + getFullHeight().width + "‘ height=‘450‘>";

htmlstr += "<param name=‘allowFullScreen‘ value=‘true‘/>"

htmlstr += "<param name=‘Filename‘ value=‘‘/>"

htmlstr += "</object>";

$("#player").html(htmlstr);

?

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Microsoft.Practices.Unity.Configuration"/>

</configSections>

<unity>

<!--定义类型别名-->

<aliases>

<add alias="IProduct" type="UnityDemo.IProduct,UnityDemo" />

<add alias="Milk" type="UnityDemo.Milk,UnityDemo" />

<add alias="Sugar" type="UnityDemo.Sugar,UnityDemo" />

?

<add alias="IPerson" type="IClass.IPerson,IClass" />

<add alias="Chinese" type="DIDemo.Chinese,DIDemo" />

</aliases>

?

<!--容器-->

<container name="mycontainer">

<!--映射关系-->

<register type="IProduct" mapTo="Milk"></register>

<register type="IProduct" mapTo="Sugar" name="Sugar"></register>

<register type="IPerson" mapTo="Chinese" name="c"></register>

</container>

</unity>

</configuration>

?

static void Main(string[] args)

{

//ContainerCode();

?

ContainerConfiguration();

?

?

Console.ReadKey();

}

?

?

static void ContainerCode()

{

IUnityContainer container = new UnityContainer();

?

//默认注册(无命名),如果后面还有默认注册会覆盖前面的

container.RegisterType<IProduct, Milk>();

?

//ContainerControlledLifetimeManager,注册为单例类

//container.RegisterType<IProduct, Milk>(new ContainerControlledLifetimeManager());

?

//命名注册

container.RegisterType<IProduct, Sugar>("Sugar");

?

//解析默认对象

IProduct _product = container.Resolve<IProduct>();

_product.ClassName = _product.GetType().ToString();

_product.ShowInfo();

?

//指定命名解析对象

IProduct _sugar = container.Resolve<IProduct>("Sugar");

_sugar.ClassName = _sugar.GetType().ToString();

_sugar.ShowInfo();

?

IEnumerable<IProduct> classList = container.ResolveAll<IProduct>();

?

foreach (var item in classList)

{

item.ClassName = item.GetType().ToString();

item.ShowInfo();

}

}

?

?

//配置文件注入代码

static void ContainerConfiguration()

{

IUnityContainer container = new UnityContainer();

?

UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

section.Configure(container, "mycontainer");//mycontainer

?

IProduct product = container.Resolve<IProduct>("Sugar");

product.ClassName = "fjsdkjflksd";

product.ShowInfo();

?

IPerson p = container.Resolve<IPerson>("c");

string a = p.Speak();

Console.WriteLine(a);

}

Test,使用word发布博客12332434345454654

标签:

原文地址:http://www.cnblogs.com/liuguangyin/p/4964920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!