run as administrator c# code example
Example 1: how to run a function as administrator in c#
[PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")]
public void MyMethod()
{
}
Example 2: c# request run as administrator
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />