示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            SortedArrayDictionary <K, V> clone = new SortedArrayDictionary <K, V>(Comparer, EqualityComparer);

            clone.sortedpairs.AddSorted(sortedpairs);
            return(clone);
        }
示例#2
0
            //TODO: test
            /// <summary>
            /// Make a shallow copy of this SortedKeysCollection.
            /// </summary>
            /// <returns></returns>
            public virtual object Clone()
            {
                //
                SortedArrayDictionary <K, V>       dictclone        = new SortedArrayDictionary <K, V>(sortedpairs.Count, comparer, EqualityComparer);
                SortedArray <KeyValuePair <K, V> > sortedpairsclone = (SortedArray <KeyValuePair <K, V> >)(dictclone.sortedpairs);

                foreach (K key in sorteddict.Keys)
                {
                    sortedpairsclone.Add(new KeyValuePair <K, V>(key, default(V)));
                }
                return(new SortedKeysCollection(dictclone, sortedpairsclone, comparer, EqualityComparer));
            }