zoukankan
html css js c++ java
C#动态加载类
using
System;
using
System.Data;
using
System.Reflection;
using
System.Web;
using
System.Web.UI;
namespace
WebApplication1
{
/**/
///
<summary>
///
Class1 的摘要说明。
///
</summary>
public
class
Servlets:System.Web.UI.Page
{
private
void
Page_Load(
object
sender, System.EventArgs e)
{
//
在此处放置用户代码以初始化页面
Response.Write(InitPage());
AfterLoadPage();
//
string aliasName="test2.Class2";
//
result.AppAssembly = ((ClassItem)item).ClassAssembly;
//
return result;
//
Assembly assem= Assembly.Load(aliasName);
Type[] helloType
=
LoadAssembly(
"
test2
"
);
MethodInfo printMethod
=
helloType[
0
].GetMethod(
"
reback
"
);
Object obj
=
Activator.CreateInstance(helloType[
0
]);
Response.Write(printMethod.Invoke(obj,
null
));
//
Object[] args = new Object[1];
//
args[0] = "From CSharp Late Bound";
//
printMethod.Invoke(obj, args);
//
//
Response.Write(result);
}
public
Type[] LoadAssembly(
string
filename)
{
Type[] functionList
=
new
Type[
10
];
Assembly assembly
=
AppDomain.CurrentDomain.Load(filename);
int
i
=
0
;
foreach
(Type t
in
assembly.GetTypes())
{
functionList[i]
=
t;
i
=
i
+
1
;
}
return
functionList;
}
protected
virtual
void
AfterLoadPage()
{
}
protected
virtual
string
InitPage()
{
return
"
BASE
"
;
}
//
Web 窗体设计器生成的代码
Web 窗体设计器生成的代码
#region
Web 窗体设计器生成的代码
override
protected
void
OnInit(EventArgs e)
{
//
//
CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base
.OnInit(e);
}
/**/
/**/
/**/
///
<summary>
///
设计器支持所需的方法 - 不要使用代码编辑器修改
///
此方法的内容。
///
</summary>
private
void
InitializeComponent()
{
this
.Load
+=
new
System.EventHandler(
this
.Page_Load);
}
#endregion
}
}
查看全文
相关阅读:
蓝牙音箱的连接和断开
画一个钟表,陪着我走
利用MediaSession发送信息到蓝牙音箱
修改Switch 的颜色
ViewPager PagerAdapter 的使用
错误:android.view.InflateException: Binary XML file line #167: Binary XML file line #167: Error inflating class <unknown>
react-project(一)
create-react-app重建
nodeJS连接mysql
nodeJS问题
原文地址:https://www.cnblogs.com/chinatefl/p/279656.html
最新文章
禁止uiscrollview垂直方向滚动,只允许水平方向滚动;或只允许垂直方向滚动
时间比较
IOS开发证书显示“此证书的签发者无效”解决方法
UIView上的按钮跳转到一个控制器UIViewController上去
iOS Xcode编译报错问题解决办法汇总
CGAffineTransformMakeRotation 实现旋转
全国省市县数据爬虫
PyTorch迁移学习-私人数据集上的蚂蚁蜜蜂分类
PyTorch入门-CIFAR10图像分类
Android自定义Dialog
热门文章
Python使用asyncio+aiohttp异步爬取猫眼电影专业版
linux字符终端(控制台)的字体更改
Python爬虫 使用selenium处理动态网页
基于JSP+Servlet的学生信息管理系统
一个简单的Android音乐播放器
Python连接mysql数据库
Spring boot -环境搭建 ,初步接触(1)
侧边索引
判断wifi是2.4G还是5G
Android Studio Library 编译成 jar,aar
Copyright © 2011-2022 走看看