Esempio n. 1
0
        /// <summary>
        /// Makes a shallow copy of the current DojoClassCollection.
        /// as the parent object.
        /// </summary>
        /// <returns>DojoClassCollection</returns>
        public DojoClassCollection Clone()
        {
            DojoClassCollection clonedDojoClass = new DojoClassCollection(count);

            lock (this)
            {
                foreach (DojoClass item in this)
                {
                    clonedDojoClass.Add(item);
                }
            }
            return(clonedDojoClass);
        }
Esempio n. 2
0
        /// <summary>
        /// Makes a deep copy of the current DojoClass.
        /// </summary>
        /// <param name="isolation">Placeholders are used to isolate the
        /// items in the DojoClassCollection from their children.</param>
        public DojoClassCollection Copy(bool isolated)
        {
            DojoClassCollection isolatedCollection = new DojoClassCollection(count);

            lock (this)
            {
                if (isolated)
                {
                    for (int i = 0; i < count; i++)
                    {
                        isolatedCollection.Add(DojoClassArray[i].NewPlaceHolder());
                    }
                }
                else
                {
                    for (int i = 0; i < count; i++)
                    {
                        isolatedCollection.Add(DojoClassArray[i].Copy());
                    }
                }
            }
            return(isolatedCollection);
        }