using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace Kernel.Interface
{
public interface IObjcet
{
void Put(); void Put(string plus);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kernel.Interface; namespace Kernel.SimpleLibrary
{
public class PlugPut : IObjcet
{ private string plugName = ""; public string PlugName
{
get { return plugName; }
set { plugName = value; }
} public PlugPut() { } public PlugPut(string plusName)
{
this.PlugName = plusName;
} public void Put()
{
Console.WriteLine("Default plug value is:" + plugName);
} public void Put(string plus)
{
Console.WriteLine("Put plus value is:" + plus);
}
}
}
using Kernel.DriverLibrary;
using Kernel.Interface;
using Kernel.SimpleLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting;
using System.Text;
using System.Threading.Tasks; namespace Kernel.App
{
class Program
{
static void Main(string[] args)
{ #region
//用传递参数来得到一个类的实例 //用Activator.CreateInstance创建默认的不带参数的构造函数
IObjcet obj = (IObjcet)Activator.CreateInstance(
                  System.Type.GetType("Kernel.SimpleLibrary.PlugPut,Kernel.SimpleLibrary"), null);
obj.Put();
obj.Put("plug 1"); //System.Type.GetType(命名空间.类名,程序集) //用Activator.CreateInstance创建另一个带参数构造函数实例
IObjcet obj2 = (IObjcet)System.Activator.CreateInstance(
                  System.Type.GetType("Kernel.SimpleLibrary.PlugPut,Kernel.SimpleLibrary"),
                  new string[] { "Hello world!" });
obj2.Put();
obj.Put("plug 2");
#endregion Console.ReadLine();
}
}
}

最新文章

  1. java并发编程(十九)障碍器CyclicBarrier
  2. ZooKeeper 配置
  3. C# windows form如何隐藏窗口?
  4. 使用PHP发送email进行账号激活或者密码修改操作
  5. net TreeView 递归
  6. MVC中使用EF+MySQL
  7. 修复 XE8 FMX TGridLayout 容器自动计算宽度及高度的问题
  8. 初识lua
  9. http 需要掌握的知识点(一)
  10. MongoDB的备份(mongodump)与恢复(mongorestore)
  11. HTML 详细介绍
  12. hdu 1561 The more, The Better (依赖背包 树形dp)
  13. Spring整合JMS-基于activeMQ实现(二)
  14. Commix命令注入漏洞利用
  15. 深入浅出了解OCR识别票据原理(Applying OCR Technology for Receipt Recognition)
  16. 使用交互式方式在SQL server2017上创建数据库
  17. php优秀的库
  18. HTML5-全局属性
  19. thinkphp中的内置操作数据库与mysql中的函数汇总
  20. DRF序列化/反序列化

热门文章

  1. WebSocket 实战(转)
  2. 1.4(Spring学习笔记)Spring-JDBC基础
  3. 十. 图形界面(GUI)设计9.列表和组合框
  4. Eclipse / Pycharm | 使用过程中的一些问题笔记
  5. 【转载】linux2.6内核initrd机制解析
  6. Flex State
  7. docker常用命令 状态图
  8. Lucene的学习及使用实验
  9. 虚拟机设置NAT上网
  10. redux-actions