예제 #1
0
        /// <summary>
        /// Makes a shallow copy of the current DojoTestCollection.
        /// as the parent object.
        /// </summary>
        /// <returns>DojoTestCollection</returns>
        public DojoTestCollection Clone()
        {
            DojoTestCollection clonedDojoTest = new DojoTestCollection(count);

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

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