如何将类型“object”显示转换为“Microsoft.Win32.RegistryKey”
各位高手帮忙指点指点~
我刚学面向对象
今天写了个东西,可是有个问题没有能解决
我就是想实现对注册表的一些小操作,
源代码这样的:
namespace Regedit
{
    public class Regedit
    {
        public readonly object path;
        public Regedit(object newPath)
        {
            path = newPath;
        }
        public string[] ReadRegedit()
        {
            RegistryKey RegeditPath = path;
            return RegeditPath.GetValueNames();
        }
        public void DeletRegedit(string value)
        {
            RegistryKey RegeditPath = path;
            try
            {
                RegeditPath.DeleteValue(value, true);
            }
            catch
            {
                Console.WriteLine("您要删除的信息不存在");
            }
        }
        public void UpRegedit(string value)
        {
            RegistryKey RegeditPath = path;
            foreach (string site in RegeditPath.GetValueNames())
            {
                try
                {
                    if (site == value)
                    {
                        RegeditPath.DeleteValue(site, true);
                        RegeditPath.SetValue(value, "newName");
                    }
                    else
                    {
                        continue;
                    }
                }
                catch
                {
                    Console.WriteLine("您要更新的信息不存在");
                }
            }
        }
    }
}
之后想在实例对象时候就把要操作的注册表路径直接赋进去~
可是现在出现问题了
我path现在说要我显示转换成Microsoft.Win32.RegistryKey
小弟确实不知道该用哪个函数,或者用什么方法去解决了~希望大家帮帮忙