当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > use Assembly to call a method

ASP.NET
在C#中导入WebBrowser控件,生成具有强名称的程序集
Asp.Net中的脚本回调和Server.Transfer页面传值
暂时性的解决datagrid控件数据绑定时候xxx字段不属于xxx表的错误
http://www.donews.net/yangwl/archive/2004/10/17/136872.aspx
Some tips for using visual studio .net
Grasshopper简介(节选)
ORACLE 常用的SQL语法和数据对象
[DNN学习所得]让IE也能实现解压缩功能(提供演示源码下载)
学习笔记之Microsoft Windows服务
关于XML:以对象模型为中心
P&P Enterprise Library Extensions
简易的字符替换,可以用于用户自我介绍输入框,简单新闻回复& etc.
缩略图多路径多格式保存
"关机/休眠/重启/注销"的类
[DNN功能]自己动手做语言包
处理WinForm多线程程序时的陷阱
获得光标在多行textbox中的行与列的函数
ADO.NET 和 ADO 的比较
vb.net类的封装,继承,多态,抽象之一
Display XML in AxSHDocVw.AxWebBrowser

ASP.NET 中的 use Assembly to call a method


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 53 ::
收藏到网摘: n/a


When using objectFactory,u may want to call a static method,but would not like to write a mass of interfaces to *Show* the method.Here,it's a way.
Code:using System.Reflection;
try { Assembly asm =Assembly.Load("FC.Shared.Common"); Type t = asm.GetType("FC.Shared.Common.CMessage"); MethodInfo minfo=t.GetMethod("Send"); Object obj = Activator.CreateInstance(t); //Object obj=asm.CreateInstance("FC.Shared.Common.CMessage"); minfo.Invoke(obj,new string []{"IMMsgOut","Sender","Recipient","hello","Body","BizBody"}); } catch(Exception e) { MessageBox.Show(e.InnerException.Message); throw e.InnerException; }