/// <summary> /// Makes a shallow copy of the current DojoPromotionCollection. /// as the parent object. /// </summary> /// <returns>DojoPromotionCollection</returns> public DojoPromotionCollection Clone() { DojoPromotionCollection clonedDojoPromotion = new DojoPromotionCollection(count); lock (this) { foreach (DojoPromotion item in this) { clonedDojoPromotion.Add(item); } } return(clonedDojoPromotion); }
/// <summary> /// Makes a deep copy of the current DojoPromotion. /// </summary> /// <param name="isolation">Placeholders are used to isolate the /// items in the DojoPromotionCollection from their children.</param> public DojoPromotionCollection Copy(bool isolated) { DojoPromotionCollection isolatedCollection = new DojoPromotionCollection(count); lock (this) { if (isolated) { for (int i = 0; i < count; i++) { isolatedCollection.Add(DojoPromotionArray[i].NewPlaceHolder()); } } else { for (int i = 0; i < count; i++) { isolatedCollection.Add(DojoPromotionArray[i].Copy()); } } } return(isolatedCollection); }