/// <devdoc> /// <para> /// Gets the <see cref='System.Data.DataColumn'/> /// from the collection at the specified index. /// </para> /// </devdoc> public DataColumn this[int index] { get { try { // Perf: use the readonly _list field directly and let ArrayList check the range return((DataColumn)_list[index]); } catch (ArgumentOutOfRangeException) { throw ExceptionBuilder.ColumnOutOfRange(index); } } }
/// <summary> /// Removes the column at the specified index from the collection. /// </summary> public void RemoveAt(int index) { DataColumn dc = this[index]; if (dc == null) { throw ExceptionBuilder.ColumnOutOfRange(index); } Remove(dc); }
public void RemoveAt(int index) { DataColumn column = this[index]; if (column == null) { throw ExceptionBuilder.ColumnOutOfRange(index); } this.Remove(column); }
public void SetColumnError(int columnIndex, string error) { DataColumn column = this._columns[columnIndex]; if (column == null) { throw ExceptionBuilder.ColumnOutOfRange(columnIndex); } this.SetColumnError(column, error); }
/// <include file='doc\DataRow.uex' path='docs/doc[@for="DataRow.GetColumnError"]/*' /> /// <devdoc> /// <para>Gets the error description for the column specified /// by index.</para> /// </devdoc> public string GetColumnError(int columnIndex) { DataColumn column = Table.Columns[columnIndex]; if (column == null) { throw ExceptionBuilder.ColumnOutOfRange(columnIndex); } return(GetColumnError(column)); }
// TODO: waiting for COM+ internal fix. /// <include file='doc\DataRow.uex' path='docs/doc[@for="DataRow.IsNull"]/*' /> /// <devdoc> /// <para> /// Gets /// a value indicating whether the column at the specified index contains a /// null value. /// </para> /// </devdoc> public bool IsNull(int columnIndex) { DataColumn column = Table.Columns[columnIndex]; if (column == null) { throw ExceptionBuilder.ColumnOutOfRange(columnIndex); } return(IsNull(column)); }
/// <include file='doc\DataColumnCollection.uex' path='docs/doc[@for="DataColumnCollection.this"]/*' /> /// <devdoc> /// <para> /// Gets the <see cref='System.Data.DataColumn'/> /// from the collection at the specified index. /// </para> /// </devdoc> public virtual DataColumn this[int index] { get { // PROFILE: leave the lists as variable access because they generate lots of calls // in profiler. if (index >= 0 && index < list.Count) { return((DataColumn)list[index]); } throw ExceptionBuilder.ColumnOutOfRange(index); } }
public DataColumn this[int index] { get { DataColumn column; try { column = (DataColumn)this._list[index]; } catch (ArgumentOutOfRangeException) { throw ExceptionBuilder.ColumnOutOfRange(index); } return(column); } }
/// <include file='doc\DataRowView.uex' path='docs/doc[@for="DataRowView.this"]/*' /> /// <devdoc> /// <para> /// Gets or sets a value in a specified column. /// </para> /// </devdoc> public object this[int ndx] { get { if (!(0 <= ndx && ndx < dataView.Table.Columns.Count)) { throw ExceptionBuilder.ColumnOutOfRange(ndx); } return(row[ndx, dataView.IsOriginalVersion(this.index) ? DataRowVersion.Original : DataRowVersion.Default]); } set { if (!(0 <= ndx && ndx < dataView.Table.Columns.Count)) { throw ExceptionBuilder.ColumnOutOfRange(ndx); } if (!dataView.AllowEdit && (row != dataView.addNewRow)) { throw ExceptionBuilder.CanNotEdit(); } SetColumnValue(dataView.Table.Columns[ndx], value); } }