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

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

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