public I3Row Add() { I3Row row = new I3Row(); Add(row); return(row); }
/// <summary> /// Removes the specified Row from the model /// </summary> /// <param name="row">The Row to remove</param> public void Remove(I3Row row) { int rowIndex = this.IndexOf(row); if (rowIndex != -1) { this.RemoveAt(rowIndex); } }
/// <summary> /// Removes the Row at the specified index from the collection /// </summary> /// <param name="index">The index of the Row to remove</param> public new void RemoveAt(int index) { if (index >= 0 && index < this.Count) { I3Row row = this[index]; this.List.RemoveAt(index); this.OnRowRemoved(new I3TableModelEventArgs(this.owner, row, index, index)); } }
/// <summary> /// Returns the index of the specified Row in the model /// </summary> /// <param name="row">The Row to look for</param> /// <returns>The index of the specified Row in the model</returns> public int IndexOf(I3Row row) { for (int i = 0; i < this.Count; i++) { if (this[i] == row) { return(i); } } return(-1); }
/// <summary> /// Adds the specified Row to the end of the collection /// </summary> /// <param name="row">The Row to add</param> public int Add(I3Row row) { if (row == null) { throw new System.ArgumentNullException("Row is null"); } int index = this.List.Add(row); this.OnRowAdded(new I3TableModelEventArgs(this.owner, row, index, index)); return(index); }
/// <summary> /// Replaces the Row at the specified index to the specified Row /// </summary> /// <param name="index">The index of the Row to be replaced</param> /// <param name="row">The Row to be placed at the specified index</param> internal void SetRow(int index, I3Row row) { if (index < 0 || index >= this.Count) { throw new ArgumentOutOfRangeException("value"); } if (row == null) { throw new ArgumentNullException("row cannot be null"); } this.List[index] = row; row.InternalIndex = index; }
/// <summary> /// Inserts a Row into the collection at the specified index /// </summary> /// <param name="index">The zero-based index at which the Row /// should be inserted</param> /// <param name="row">The Row to insert</param> public void Insert(int index, I3Row row) { if (row == null) { return; } if (index < 0) { throw new IndexOutOfRangeException(); } if (index >= this.Count) { this.Add(row); } else { base.List.Insert(index, row); this.owner.OnRowAdded(new I3TableModelEventArgs(this.owner, row, index, index)); } }