是这样的:
#region 判断指定的键值是否存在
        /// <summary>
        /// 检测指定的键值是否存在
        /// </summary>
        /// <param name="keyPath">路径</param>
        /// <param name="subKey">键名</param>
        /// <returns>1.true 2.false</returns>
        public bool IsRegeditKeyExit(string keyPath,string subKey)
        {
            string[] subkeyNames;
            RegistryKey hkml = Registry.LocalMachine;            //定位到注册表最开头分支
            try
            {
                RegistryKey software = hkml.OpenSubKey(keyPath);       //打开指定的键值
                subkeyNames = software.GetValueNames();             //将该项下的所有键值的名字放到数据中
                foreach (string keyName in subkeyNames)
                {
                    if (keyName == subKey)
                    {
                        hkml.Close();
                        return true;
                    }
                }
            }
            catch
            {
                return false;
            }
            finally
            {
                hkml.Close();
            }
            return false;
        }
        #endregion这个方法RegistryKey hkml = Registry.LocalMachine;            //定位到注册表最开头分支
这个注册表定位到LocalMachine,但还有其它地方要用到HKEY_CURRENT_USER这个根,我要怎么写这个公共可改的方法呢?
也就是我只要在这个方法加一个参数来确定我要对注册表的哪个根进行操作;
不会....
高人指点一下吧?