/// <inheritdoc/> public IEntityCollection Clone() { var clone = new ConcurrentEntityCollection(_entities.Comparer); foreach (var pair in _entities.Values) { clone.Add(pair.Clone()); } return(clone); }
/// <summary> /// Clones the instance. /// </summary> /// <returns> /// The cloned instance. /// </returns> protected virtual ICloneable Clone() { _lock.EnterReadLock(); try { var clone = new ConcurrentEntityCollection(Comparer); foreach (var entity in this) { clone.Add((IEntity)entity.Clone()); } return(clone); } finally { _lock.ExitReadLock(); } }