首页 > 学院 > 开发设计 > 正文

C#:判断当前程序是否通过管理员运行

2019-11-17 02:46:46
字体:
来源:转载
供稿:网友

C#:判断当前程序是否通过管理员运行

public bool IsAdministrator(){WindowsIdentity current = WindowsIdentity.GetCurrent();WindowsPRincipal windowsPrincipal = new WindowsPrincipal(current);return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);}

转载声明:本文转载至http://www.zhoumy.cn/?id=4


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表