|
Il presente articolo è stato tradotto manualmente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale.
|
Traduzione
Originale
|
Classe RegistryKey
Assembly: mscorlib (in mscorlib.dll)
Il tipo RegistryKey espone i seguenti membri.
| Nome | Descrizione | |
|---|---|---|
![]() | Handle | |
![]() | Name | |
![]() | SubKeyCount | |
![]() | ValueCount | |
![]() | View |
| Nome | Descrizione | |
|---|---|---|
![]() | Close | |
![]() | CreateObjRef | |
![]() | CreateSubKey(String) | |
![]() | CreateSubKey(String, RegistryKeyPermissionCheck) | |
![]() | CreateSubKey(String, RegistryKeyPermissionCheck, RegistryOptions) | |
![]() | CreateSubKey(String, RegistryKeyPermissionCheck, RegistrySecurity) | |
![]() | CreateSubKey(String, RegistryKeyPermissionCheck, RegistryOptions, RegistrySecurity) | |
![]() | DeleteSubKey(String) | |
![]() | DeleteSubKey(String, Boolean) | |
![]() | DeleteSubKeyTree(String) | |
![]() | DeleteSubKeyTree(String, Boolean) | |
![]() | DeleteValue(String) | |
![]() | DeleteValue(String, Boolean) | |
![]() | Dispose | |
![]() | Equals(Object) | |
![]() | Finalize | |
![]() | Flush | |
![]() ![]() | FromHandle(SafeRegistryHandle) | |
![]() ![]() | FromHandle(SafeRegistryHandle, RegistryView) | |
![]() | GetAccessControl() | |
![]() | GetAccessControl(AccessControlSections) | |
![]() | GetHashCode | |
![]() | GetLifetimeService | |
![]() | GetSubKeyNames | |
![]() | GetType | |
![]() | GetValue(String) | |
![]() | GetValue(String, Object) | |
![]() | GetValue(String, Object, RegistryValueOptions) | |
![]() | GetValueKind | |
![]() | GetValueNames | |
![]() | InitializeLifetimeService | |
![]() | MemberwiseClone() | |
![]() | MemberwiseClone(Boolean) | |
![]() ![]() | OpenBaseKey | |
![]() ![]() | OpenRemoteBaseKey(RegistryHive, String) | |
![]() ![]() | OpenRemoteBaseKey(RegistryHive, String, RegistryView) | |
![]() | OpenSubKey(String) | |
![]() | OpenSubKey(String, RegistryKeyPermissionCheck) | |
![]() | OpenSubKey(String, Boolean) | |
![]() | OpenSubKey(String, RegistryKeyPermissionCheck, RegistryRights) | |
![]() | SetAccessControl | |
![]() | SetValue(String, Object) | |
![]() | SetValue(String, Object, RegistryValueKind) | |
![]() | ToString |
Attenzione |
|---|
using System; using System.Security.Permissions; using Microsoft.Win32; class RegKey { static void Main() { // Create a subkey named Test9999 under HKEY_CURRENT_USER. RegistryKey test9999 = Registry.CurrentUser.CreateSubKey("Test9999"); // Create two subkeys under HKEY_CURRENT_USER\Test9999. The // keys are disposed when execution exits the using statement. using(RegistryKey testName = test9999.CreateSubKey("TestName"), testSettings = test9999.CreateSubKey("TestSettings")) { // Create data for the TestSettings subkey. testSettings.SetValue("Language", "French"); testSettings.SetValue("Level", "Intermediate"); testSettings.SetValue("ID", 123); } // Print the information from the Test9999 subkey. Console.WriteLine("There are {0} subkeys under {1}.", test9999.SubKeyCount.ToString(), test9999.Name); foreach(string subKeyName in test9999.GetSubKeyNames()) { using(RegistryKey tempKey = test9999.OpenSubKey(subKeyName)) { Console.WriteLine("\nThere are {0} values for {1}.", tempKey.ValueCount.ToString(), tempKey.Name); foreach(string valueName in tempKey.GetValueNames()) { Console.WriteLine("{0,-8}: {1}", valueName, tempKey.GetValue(valueName).ToString()); } } } using(RegistryKey testSettings = test9999.OpenSubKey("TestSettings", true)) { // Delete the ID value. testSettings.DeleteValue("id"); // Verify the deletion. Console.WriteLine((string)testSettings.GetValue( "id", "ID not found.")); } // Delete or close the new subkey. Console.Write("\nDelete newly created registry key? (Y/N) "); if(Char.ToUpper(Convert.ToChar(Console.Read())) == 'Y') { Registry.CurrentUser.DeleteSubKeyTree("Test9999"); Console.WriteLine("\nRegistry key {0} deleted.", test9999.Name); } else { Console.WriteLine("\nRegistry key {0} closed.", test9999.ToString()); test9999.Close(); } } }
Windows 7, Windows Vista SP1 o versione successiva, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (componenti di base del server non supportati), Windows Server 2008 R2 (componenti di base del server supportati con SP1 o versione successiva), Windows Server 2003 SP2
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
