using Microsoft.Win32; RegistryKey key = Registry.CurrentUser.CreateSubKey("Software\\MyApp\\Settings"); key.SetValue("Username", "John"); key.Close();
using Microsoft.Win32; RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\MyApp\\Options", true); if (key != null) { key.SetValue("LogLevel", 3); key.Close(); }The RegistryKey class is part of the Microsoft.Win32 namespace in the .NET Framework.