博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Unity of Prism
阅读量:4313 次
发布时间:2019-06-06

本文共 856 字,大约阅读时间需要 2 分钟。

using System;

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using Microsoft.Practices.Unity;

namespace Example.LearnConsole {
class Program {
/// <summary>
/// 这是一个最基本的结构
/// </summary>
/// <param name="args"></param>
static void Main(string[] args) {
IUnityContainer uc = new UnityContainer();

uc.RegisterType<IService, CustomerService>();

IService service = uc.Resolve<IService>();

service.Show();

Console.Read();

}
}

public interface IService {

void Show();
}

public class CustomerService : IService {

public void Show() {

Console.WriteLine("Welcome");
}
}

public class Proxy {

IService service;
public Proxy(IService service) {
this.service = service;
}
}
}

转载于:https://www.cnblogs.com/limingming/archive/2012/04/16/2451730.html

你可能感兴趣的文章
Linux下获取本机IP地址的代码
查看>>
(C#)调用Webservice,提示远程服务器返回错误(500)内部服务器错误
查看>>
flex布局
查看>>
python-----python的文件操作
查看>>
java Graphics2d消除锯齿,使字体平滑显示
查看>>
控件中添加的成员变量value和control的区别
查看>>
Spring Boot Docker 实战
查看>>
Div Vertical Menu ver3
查看>>
Git简明操作
查看>>
InnoDB为什么要使用auto_Increment
查看>>
课堂练习之买书打折最便宜
查看>>
定义函数
查看>>
网络虚拟化技术(二): TUN/TAP MACVLAN MACVTAP
查看>>
MQTT协议笔记之mqtt.io项目HTTP协议支持
查看>>
(转)jQuery中append(),prepend()与after(),before()的区别
查看>>
Tecplot: Legend和图像中 Dashed/Dash dot/Long dash 等虚线显示没有区别的问题
查看>>
蜕变成蝶~Linux设备驱动之异步通知和异步I/O
查看>>
jquery简单开始
查看>>
作业2
查看>>
ios上架报错90080,90087,90209,90125 解决办法
查看>>