1: 2: 3: 4: 5: 6:
using System.Security.Permissions; RegistryPermission permission = new RegistryPermission(RegistryPermissionAccess.AllAccess,@"HKEY_LOCAL_ MACHINE\Software\MySoftware\MyKey"); permission.Demand();