0
点赞
收藏
分享

微信扫一扫

c# 运行时判断是否为DEBUG模式

我是芄兰 2022-07-28 阅读 51
编程语言

public static bool RunningModeIsDebug
{
get
{

var assebly = Assembly.GetEntryAssembly();
if (assebly == null)
{
assebly = new StackTrace().GetFrames().Last().GetMethod().Module.Assembly;
}

var debugableAttribute = assebly.GetCustomAttribute<DebuggableAttribute>();
var isdebug = debugableAttribute.DebuggingFlags.HasFlag(DebuggableAttribute.DebuggingModes.EnableEditAndContinue);

return isdebug;
}
}

​​参考​​



举报

相关推荐

0 条评论