RPS.Screensaver.IsRunAsAdmin C# (CSharp) Method

IsRunAsAdmin() static private method

The function checks whether the current process is run as administrator. In other words, it dictates whether the primary access token of the process belongs to user account that is a member of the local Administrators group and it is elevated.
static private IsRunAsAdmin ( ) : bool
return bool
        static bool IsRunAsAdmin() {
            WindowsIdentity id = WindowsIdentity.GetCurrent();
            WindowsPrincipal principal = new WindowsPrincipal(id);
            return principal.IsInRole(WindowsBuiltInRole.Administrator);
        }