/// <summary> /// Gets or sets the <see cref="DomainObject"/> with a given <paramref name="index"/> in the <see cref="DomainObjectCollection"/>. /// </summary> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="index"/> is less than zero.<br /> -or- <br /> /// <paramref name="index"/> is equal to or greater than the number of items in the collection. /// </exception> /// <exception cref="System.NotSupportedException">The collection is read-only.</exception> /// <exception cref="System.ArgumentException"> /// <paramref name="value"/> is not a derived type of <see cref="DomainObject"/> and of type <see cref="RequiredItemType"/> or a derived type. /// </exception> /// <exception cref="System.InvalidOperationException"><paramref name="value"/> is already part of the collection.</exception> public DomainObject this [int index] { get { return(_dataStrategy.GetObject(index)); } set { this.CheckNotReadOnly("Cannot modify a read-only collection."); // If new value is null: This is actually a remove operation if (value == null) { RemoveAt(index); } else { _dataStrategy.Replace(index, value); } } }
public virtual void Replace(int index, DomainObject value) { ArgumentUtility.CheckNotNull("value", value); _wrappedData.Replace(index, value); }