博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
判断dll是版本(Debug Or Release)[测试通过]
阅读量:6940 次
发布时间:2019-06-27

本文共 768 字,大约阅读时间需要 2 分钟。

简单的代码,google搜索提炼和分析,主要是利用反射技术,测试通过,抛砖引玉,自娱自乐,多多指教。

 
public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(
!
IsPostBack)
{
Assembly ass
=
Assembly.LoadFile(
@"
D:\com.uuu9.api.dll
"
);
DebuggableAttribute att
=
Utils.GetCustomAttribute
<
DebuggableAttribute
>
(ass);
Response.Write(att.IsJITTrackingEnabled
?
"
Debug
"
:
"
Release
"
);
}
}
}
public
static
class
Utils
{
public
static
T GetCustomAttribute
<
T
>
(
this
ICustomAttributeProvider provider)
where
T : Attribute
{
var attributes
=
provider.GetCustomAttributes(
typeof
(T),
false
);
return
attributes.Length
>
0
?
attributes[
0
]
as
T :
default
(T);
}
}

本文转自王磊的博客博客园博客,原文链接:http://www.cnblogs.com/vipstone/archive/2011/02/16/1955932.html,如需转载请自行联系原作者
你可能感兴趣的文章
Here's to the crazy ones.
查看>>
react router browserhistory 关于 Nginx配置
查看>>
Focal Loss 的前向与后向公式推导
查看>>
CSharp设计模式读书笔记(4):单例模式(学习难度:★☆☆☆☆,使用频率:★★★★☆)...
查看>>
PostgreSQL远端访问
查看>>
家庭里如何搭建一个互联网可访问的服务器
查看>>
eclipse与SVN 结合(删除SVN中已经上传的问题)
查看>>
webBrowser 模拟登录
查看>>
t4 template multi file output
查看>>
深入理解Fsync
查看>>
剑道基础 - 冈宪次郎
查看>>
Leading and Trailing(数论/n^k的前三位)题解
查看>>
我的php笔记(一)
查看>>
vue.js学习之better-scroll封装的轮播图初始化失败
查看>>
去掉xcode编译warning:ld: warning: directory not found for option '-L
查看>>
杭电1702--ACboy needs your help again!
查看>>
web前端开发分享-css,js进阶篇
查看>>
安大校赛/异或运算一题。
查看>>
ANT build.xml文件详解
查看>>
MVC和观察者模式
查看>>