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

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

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