/// <summary> /// Inserts an object into the RelatedObjectList at the specified index. /// </summary> /// <param name="index">The zero-based index at which an object should be inserted.</param> /// <param name="item">The object to insert. Duplicates will be ignored.</param> public void Insert(int index, TypeProjection item) { if (IsReadOnly) { throw new InvalidOperationException("Cannot insert into a read-only list."); } if (item == null) { throw new ArgumentNullException("Cannot insert a null value on a RelatedObjectList."); } if (!IsOfType(typeof(T), item.GetType())) { throw new InvalidOperationException("This RelatedObjectList only supports inserting objects of type " + typeof(T).Name); } if (!Contains(item)) { ProjectionList.Insert(index, item.CurrentObject); Owner.IsDirty = true; } }