using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace Kernel.SimpleLibrary
{
public class Person
{
private string name; public Person(){ } public Person(string name)
{
this.name = name;
} public string Name
{
get { return this.name; }
set { this.name = value; }
} public override string ToString()
{
return this.name;
}
}
}
using System;
using System.Reflection;
using System.Runtime.Remoting; public class Program
{
static void Main(string[] args)
{
//创建在指定程序集中定义的指定类型的新实例
//assemblyName = 命名空间,typeName = 命名空间.类名
ObjectHandle handle = Activator.CreateInstance("Kernel.SimpleLibrary", "Kernel.SimpleLibrary.Person");
Object p = handle.Unwrap();
Type t = p.GetType();
PropertyInfo prop = t.GetProperty("Name");
if (prop != null)
prop.SetValue(p, "Hello world!"); MethodInfo method = t.GetMethod("ToString");
Object retVal = method.Invoke(p, null);
if (retVal != null)
Console.WriteLine(retVal);
}
}

最新文章

  1. 【HDU】4773 Problem of Apollonius
  2. WinForm------TreeList加载数据方法
  3. 深入理解 Win32 PE 文件格式
  4. LeetCode:Climbing Stairs(编程之美2.9-斐波那契数列)
  5. mysql存储过程笔记
  6. 排序算法总结(一)插入排序【Insertion Sort】
  7. linux安装
  8. approval workflow in sharepoint designer
  9. Android模拟器常用命令收录
  10. inline与lnk2001、lnk2019,鸡肋?
  11. Linux经常使用命令(一) - ls
  12. Java接口的实例应用:致敬我的偶像——何塞·穆里尼奥
  13. IOS自带输入法中文不触发KEYUP事件导致vue双向绑定错误问题
  14. AI 线性回归
  15. Spring日记_01 之基于maven的Spring环境搭建
  16. C++编译器详解(一)
  17. 代码面试集锦 2 - Google
  18. PHP 如何 安全配置
  19. conda
  20. 20155316 2016-2017-2 《Java程序设计》第8周学习总结

热门文章

  1. 指定等级 Exercise07_01
  2. Swift开发经验——外部参数名
  3. 玩转JavaScript正则表达式
  4. iOS开发笔记_4自定义TabBar
  5. rundll32.exe的相关使用语句
  6. oracle 10g函数大全--转换函数
  7. struts2设置文件上传大小
  8. How to backup a remote PostgreSQL db and restore it locally?
  9. C#写的一个视频转换解码器
  10. 远程管理服务 Windows Remote Management (WS-Management)