using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection; namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{ Assembly nc = Assembly.LoadFile(Environment.CurrentDirectory + "\\PersonOperator.dll"); Type t = nc.GetType("PersonOperator.Person",true); object o = Activator.CreateInstance(t, new object[] { "你", 20 }); FieldInfo f = t.GetField("name");
f.SetValue(o, "奥特你们"); PropertyInfo p = t.GetProperty("Name");
p.SetValue(o, "你哈", null); MethodInfo m = t.GetMethod("Play", new Type[] { });
m.Invoke(o, null); MethodInfo m1 = t.GetMethod("Play", new Type[] { typeof(string),typeof(string) });
m1.Invoke(o, new object[]{"低价傲人","你好"}); Console.ReadKey(); }
}
}

  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace PersonOperator
{
public class Person
{
public string name;
public int age;
public string gender; public string Name
{
get { return name; }
set { name = value; }
}
public int Age
{
get { return age; }
set { age = value; }
}
public string Gender
{
get { return gender; }
set { gender = value; }
} public Person(string _name,int _age)
{
name = _name;
age = _age;
} public void Play()
{
Console.WriteLine(name+"去打篮球");
}
public void Play(string name2,string name3)
{
Console.WriteLine(name + "和"+name2+"去打篮球"+name3+"奥特曼");
}
}
}

  

最新文章

  1. Semaphore(计数信号量)
  2. 使用ActivityGroup类显示多个Activity
  3. iptables常规使用
  4. STL---vector(向量)
  5. 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数001·3D函数
  6. 什么是RST包,什么是三次握手,什么是四次握手 ---请进
  7. 【spring 7】spring和Hibernate的整合:声明式事务
  8. flume-ng+Kafka+Storm+HDFS 实时系统搭建
  9. http://www.myexception.cn/program/767123.html
  10. 使用python通过SSH登陆linux并操作
  11. 从敏捷开发到小团队SVN
  12. 复习IOS多线程知识
  13. C# XML流操作简单实例
  14. AngularJs ui-router 路由的介绍
  15. java中重载变长参数方法
  16. BZOJ 5039: [Jsoi2014]序列维护
  17. EF6实现软删除
  18. MySQL 解压缩版安装 2017-12-02(完整版,包括异常处理)
  19. 4.8 Sublime Text3 中配置 Python环境 --之下Sublime配置Python环境
  20. nginx 操作笔记

热门文章

  1. 使用已有PDB克隆PDB
  2. Reporting services导出的Excel文件避免出现隐藏行列的布局
  3. Java基础之创建窗口——向窗口中添加菜单(Sketcher)
  4. org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map
  5. 推荐几个sql server牛人的博客
  6. 2013年各大小IT公司待遇
  7. IIS7.5解决应用程序池回收假死问题
  8. mongo聚合和mapreduce例子
  9. ThinkPHP讲解(一)框架基础
  10. [Ubuntu] Autostart nginx, php-fpm and mysql in Ubuntu14.04