Developer, Former MVP, now at Microsoft - Best of 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
public static RegistryKey CreateSubKey(this RegistryKey rk, string subkey, bool isVolatile){ if (!isVolatile) { return rk.CreateSubKey(subkey); // i.e. no change } else { // call our own method since we cannot change the framework's return MothCreateVolatileSubKey(rk, subkey, RegistryKeyPermissionCheck.Default); }}
RegistryKey rk1 = Registry.CurrentUser.CreateSubKey("my vol", true);RegistryKey rk2 = Program.CreateSubKey(Registry.CurrentUser, "my vol", true);