- //自身文件检测
- Assembly assembly = Assembly.GetAssembly(GetType());
- bool debug = false;
- foreach (var attribute in assembly.GetCustomAttributes(false)){
- if (attribute.GetType() == typeof(System.Diagnostics.DebuggableAttribute)){
- if (((System.Diagnostics.DebuggableAttribute)attribute)
- .IsJITTrackingEnabled){
- debug = true;
- break;
- }
- }
- }
- //其它文件检测
- Assembly assembly =
- Assembly.LoadFile(System.IO.Path.GetFullPath(m_DllPath.Text));
- bool debug = false;
- foreach (var attribute in assembly.GetCustomAttributes(false)){
- if (attribute.GetType() == typeof(System.Diagnostics.DebuggableAttribute)){
- if (((System.Diagnostics.DebuggableAttribute)attribute)
- .IsJITTrackingEnabled){
- debug = true;
- break;
- }
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/1908201513498.html
来源: http://www.codesnippet.cn/detail/1908201513498.html