src/Microsoft/Windows/Registry/_Library/ExtensionMethods_IRegistry.cs
/// <summary>
/// Gets a value from a given registry hive, registry key and registry name with a single call.
/// </summary>
/// <param name="registry">The extended <see cref="IRegistry"/> instance.</param>
/// <param name="hive">The <see cref="RegistryHive"/> to use.</param>
/// <param name="view">The <see cref="RegistryView"/> to use.</param>
/// <param name="subkey">The path to the registryKey to open.</param>
/// <param name="name">The name of the value to be read.</param>
/// <param name="defaultValue">The default value to be returned, when the value is not defined.</param>
/// <returns>The value for a given name of the RegistryKey, when it exists.. Otherwise,the defaultValue gets returned.</returns>
Gets a value from a given registry hive, registry key and registry name with a single call.
Gets a value from a given registry hive registry key and registry name with a single call .
public static object GetValue( this IRegistry registry, RegistryHive hive, RegistryView view, string subkey, string name, object defaultValue ) {
            using( IRegistryKey hiveKey = registry.OpenBaseKey( hive, view ) ) {
                using( IRegistryKey subRegKey = hiveKey.OpenSubKey( subkey ) ) {
                    return null == subRegKey ? throw new NotImplementedException() : subRegKey.GetValue( name, defaultValue );
                }
            }
        }
public static object GetValue ( this IRegistry registry , RegistryHive hive , RegistryView view , string subkey , string name , object defaultValue ) { using ( IRegistryKey hiveKey = registry . OpenBaseKey ( hive , view ) ) { using ( IRegistryKey subRegKey = hiveKey . OpenSubKey ( subkey ) ) { return null == subRegKey ? throw new NotImplementedException ( ) : subRegKey . GetValue ( name , defaultValue ) ; } } }
Gets a value from a given registry hive, registry key and registry name with a single call.
Gets a value from a given registry hive registry key and registry name with a single call .
The value for a given name of the RegistryKey, when it exists.. Otherwise,the defaultValue gets returned.
The value for a given name of the RegistryKey when it exists .. Otherwise the defaultValue gets returned .
IRegistry
this
hive
RegistryHive
The  to use.
The to use .
view
RegistryView
The  to use.
The to use .
subkey
string
The path to the registryKey to open.
The path to the registryKey to open .
name
string
The name of the value to be read.
The name of the value to be read .
defaultValue
object
The default value to be returned, when the value is not defined.
The default value to be returned when the value is not defined .
registry
The extended  instance.
The extended instance .