internal XlRegistryEntries(XlRegistryType regType, string Key)
        {
            _key  = Key;
            _list = new List <XlRegistryEntry>();

            RegistryKey rk = null;

            if (regType == XlRegistryType.HKEY_CURRENT_USER)
            {
                rk = Registry.CurrentUser.OpenSubKey(_key, false);
            }
            else
            {
                rk = Registry.LocalMachine.OpenSubKey(_key, false);
            }

            if (null != rk)
            {
                string[] Values = rk.GetValueNames();
                foreach (string Value in Values)
                {
                    XlRegistryEntry   Entry = null;
                    RegistryValueKind rvk   = rk.GetValueKind(Value);
                    object            o     = rk.GetValue(Value);
                    Entry = new XlRegistryEntry(Value, o, rvk);
                    _list.Add(Entry);
                }

                rk.Close();
            }
        }
        /// <summary>
        /// Foreach Enumerator
        /// </summary>
        /// <returns></returns>
        public IEnumerator GetEnumerator()
        {
            int iCount = Count;

            XlRegistryEntry[] res_entries = new XlRegistryEntry[iCount];

            for (int i = 0; i < iCount; i++)
            {
                res_entries[i] = this[i];
            }

            for (int i = 0; i < res_entries.Length; i++)
            {
                yield return(res_entries[i]);
            }
        }
        public XlRegistryEntry this[string name]
        {
            get
            {
                int iCount = Count;
                for (int i = 1; i <= iCount; i++)
                {
                    XlRegistryEntry entry = this[i - 1];
                    if (name.Equals(entry.Name, StringComparison.CurrentCultureIgnoreCase) == true)
                    {
                        return(entry);
                    }
                }

                throw (new IndexOutOfRangeException("RegistryEntry " + name + " not found."));
            }
        }