首页 > 编程技术 > csharp

C#判断程序是否是管理员权限运行的方法代码示例

发布时间:2020-6-25 11:32

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

标签:[!--infotagslink--]

您可能感兴趣的文章: