Check if the Current User Is an Administrator

Comments
public static bool IsCurrentUserAdministrator()
{
    AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
    WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
    return principal.IsInRole(WindowsBuiltInRole.Administrator);
}