/// <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); }
/// <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); }