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

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

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

原文地址:https://www.cnblogs.com/DoNetCoder/p/4081367.html