public string GetRegistryValue(string sKeyName, string sKeyValue) { sKeyPath = "Software\\my_app\\" + sKeyName; string sRetVal = (string)Registry.LocalMachine.GetValue(sKeyPath, sKeyValue, ""); return sValue; }Now this is all fine when the registry value is a string, but it certainly isn't generic. What if the value is an int?