using Microsoft.Win32; RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft", false); string[] valueNames = key.GetValueNames(); foreach (string valueName in valueNames) { Console.WriteLine(valueName); }
using Microsoft.Win32; RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft", false); string[] valueNames = key.GetValueNames(); if (valueNames.Contains("WindowsUpdate")) { Console.WriteLine("The value pair 'WindowsUpdate' exists within this registry key."); } else { Console.WriteLine("The value pair 'WindowsUpdate' does not exist within this registry key."); }These examples use the Microsoft.Win32 package library.