System.Data.DataView.Delete C# (CSharp) Метод

Delete() публичный Метод

public Delete ( int index ) : void
index int
Результат void
		public void Delete (int index)
		{
			if (!IsOpen)
				throw new DataException ("DataView is not open.");

			if (_lastAdded != null && index == Count) {
				CompleteLastAdded (false);
				return;
			}

			if (!AllowDelete)
				throw new DataException ("Cannot delete on a DataSource where AllowDelete is false.");

			if (index > rowCache.Length)
				throw new IndexOutOfRangeException ("There is no row at position: " + index + ".");
			DataRowView row = rowCache [index];
			row.Row.Delete ();
		}

Usage Example

Пример #1
0
		void removeExpiredRows(DataTable table, string expiredColumnName) {
			string filter = string.Format(CultureInfo.InvariantCulture, "{0} < #{1}#",
				expiredColumnName, DateTime.Now);
			DataView view = new DataView(table, filter, null, DataViewRowState.CurrentRows);
			for (int i = view.Count - 1; i >= 0; i--)
				view.Delete(i);
		}
All Usage Examples Of System.Data.DataView::Delete