コード例 #1
0
        public void Remove(string cn)
        {                                              // remove cn from list
            CidListElement e = new CidListElement(cn); // create list element for proper compare

            Dict.Remove(e.Cid);
            List.Remove(e);
        }
コード例 #2
0
/// <summary>
/// Return the contents of a list as a string list
/// </summary>
/// <returns></returns>

        public List <string> ToStringList()
        {
            List <string> keyList = new List <string>();

            for (int i1 = 0; i1 < this.List.Count; i1++)
            {
                CidListElement e = (CidListElement)this.List[i1];
                if (e.Cid != null && e.Cid != "")
                {
                    keyList.Add(e.Cid);
                }
            }

            return(keyList);
        }
コード例 #3
0
        public bool Add(         // add new compound number to list return true/false
            string cn,
            bool allowDuplicates)
        {
            if (!allowDuplicates && Dict.ContainsKey(cn))
            {
                return(false);                // fail if dup and dups not allowed
            }
            CidListElement e = new CidListElement();

            e.Cid = cn;
            if (!Dict.ContainsKey(cn))
            {
                Dict.Add(cn, e);     // add to Dictionary for quick lookup
            }
            List.Add(e);             // add to list
            return(true);
        }