/// <summary> /// Inserts an <see cref="T:System.Object" /> into the /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" /> /// at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value"> /// An <see cref="T:System.Object" /> to be inserted in the /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" /> /// . /// </param> public override void Insert(int index, object value) { this.OnChange(); Check.NotNull <object>(value, nameof(value)); EntityParameterCollection.ValidateType(value); this.Validate(-1, value); this.InnerList.Insert(index, (EntityParameter)value); }
public override int Add(object value) { this.OnChange(); Check.NotNull <object>(value, nameof(value)); EntityParameterCollection.ValidateType(value); this.Validate(-1, value); this.InnerList.Add((EntityParameter)value); return(this.Count - 1); }
private void Replace(int index, object newValue) { List <EntityParameter> innerList = this.InnerList; EntityParameterCollection.ValidateType(newValue); this.Validate(index, newValue); EntityParameter entityParameter = innerList[index]; innerList[index] = (EntityParameter)newValue; entityParameter.ResetParent(); }
/// <summary> /// Adds an array of values to the end of the /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" /> /// . /// </summary> /// <param name="values"> /// The <see cref="T:System.Array" /> values to add. /// </param> public override void AddRange(Array values) { this.OnChange(); Check.NotNull <Array>(values, nameof(values)); foreach (object obj in values) { EntityParameterCollection.ValidateType(obj); } foreach (EntityParameter entityParameter in values) { this.Validate(-1, (object)entityParameter); this.InnerList.Add(entityParameter); } }
/// <summary>Removes the specified parameter from the collection.</summary> /// <param name="value"> /// A <see cref="T:System.Object" /> object to remove from the collection. /// </param> public override void Remove(object value) { this.OnChange(); Check.NotNull <object>(value, nameof(value)); EntityParameterCollection.ValidateType(value); int index = this.IndexOf(value); if (-1 != index) { this.RemoveIndex(index); } else if (this != ((EntityParameter)value).CompareExchangeParent((object)null, (object)this)) { throw new ArgumentException(Strings.EntityParameterCollectionRemoveInvalidObject); } }
/// <summary> /// Gets the location of the specified <see cref="T:System.Object" /> in the collection. /// </summary> /// <returns> /// The zero-based location of the specified <see cref="T:System.Object" /> that is a /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameter" /> /// in the collection. Returns -1 when the object does not exist in the /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" /> /// . /// </returns> /// <param name="value"> /// The <see cref="T:System.Object" /> to find. /// </param> public override int IndexOf(object value) { if (value != null) { EntityParameterCollection.ValidateType(value); List <EntityParameter> innerList = this.InnerList; if (innerList != null) { int count = innerList.Count; for (int index = 0; index < count; ++index) { if (value == innerList[index]) { return(index); } } } } return(-1); }