/// <summary>
        /// Gets a Instance of <see cref="SelectedOptionRule{T}"/> From a String value
        /// </summary>
        /// <param name="s">The String to parse for values</param>
        /// <returns>
        /// Instance of <see cref="SelectedOptionRule{T}"/> if Parse succeeded; Otherwise, null.
        /// </returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static SelectedOptionRule <T> Parse(string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                throw new ArgumentNullException();
            }
            try
            {
                // all chars except for `n and `t are single chars
                var opt = new SelectedOptionRule <T>();

                var es = s.Split(',');

                foreach (string strEs in es)
                {
                    if (string.IsNullOrWhiteSpace(strEs))
                    {
                        continue;
                    }
                    T      eValue = (T)Enum.Parse(typeof(T), strEs, false);
                    string sKey   = eValue.ToString();
                    if (opt.HasKey[sKey] == false)
                    {
                        opt.Options.Add(eValue);
                        opt.Keys.Add(sKey);
                    }
                }

                return(opt);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Gets a new <see cref="SelectedOptionRule{T}"/> instance containing the selected values of <paramref name="ListItems"/>
        /// </summary>
        /// <param name="ListItems">The list containing one or more Selected Items to add to the list</param>
        /// <returns>
        /// A new Instance of <see cref="SelectedOptionRule{T}"/> with the values that were marked as Selected in the
        /// <paramref name="ListItems"/>
        /// </returns>
        public new static SelectedOptionRule <T> FromList(IList <AhkKeyMapAhkMapValue> ListItems)
        {
            var opt = new SelectedOptionRule <T>();

            if (ListItems.Count == 0)
            {
                return(opt);
            }
            foreach (var item in ListItems)
            {
                if (item.Selected == true)
                {
                    if (opt.HasKey[item.Key] == false)
                    {
                        if (Enum.IsDefined(typeof(T), item.Key))
                        {
                            T en;
                            if (Enum.TryParse(item.Key, out en) == true)
                            {
                                opt.Options.Add(en);
                                opt.Keys.Add(item.Key);
                            }
                        }
                    }
                }
            }
            return(opt);
        }
        /// <summary>
        /// Attempts to Parse a string representing one or more Options.
        /// </summary>
        /// <param name="s">The Options to Parse</param>
        /// <param name="ec">The <see cref="SelectedOptionRule{T}"/> that represents the parsed results</param>
        /// <returns>
        /// Returns True if the parse was successful; Otherwise false
        /// </returns>
        public static bool TryParse(string s, out SelectedOptionRule <T> ec)
        {
            bool retval = false;
            SelectedOptionRule <T> outec = null;

            try
            {
                SelectedOptionRule <T> ecs = SelectedOptionRule <T> .Parse(s);

                outec  = ecs;
                retval = true;
            }
            catch (Exception)
            {
            }
            ec = outec;
            return(retval);
        }
        /// <summary>
        /// Creates a new instance of <see cref="SelectedOptionRule{T}"/> populated with the
        /// values in <paramref name="Options"/>
        /// </summary>
        /// <param name="Options">The Array of Enum Values use to populate the instance</param>
        /// <returns>
        /// Instance of <see cref="SelectedOptionRule{T}"/>. If <paramref name="Options"/> is null
        /// then return instance will have no values.
        /// </returns>
        public new static SelectedOptionRule <T> FromArray(T[] Options)
        {
            SelectedOptionRule <T> opt = new SelectedOptionRule <T>();

            if (Options == null)
            {
                return(opt);
            }
            foreach (var e in Options)
            {
                string sKey = e.ToString();
                if (opt.HasKey[sKey] == false)
                {
                    opt.Options.Add(e);
                    opt.Keys.Add(sKey);
                }
            }
            return(opt);
        }