How to remove DataColumn from DataTable programmatically
问题 I have a code foreach (DataColumn dataTableCol in this.dataTable.Columns) { bool columnFound = false; foreach (GRTColumnView uiColumn in descriptor.UIColumns) { if (dataTableCol.ColumnName.Equals(uiColumn.Name)) { columnFound = true; break; } } if (!columnFound) { if (this.dataTable.Columns.Contains(dataTableCol.ColumnName)) this.dataTable.Columns.Remove(dataTableCol.ColumnName); } } I want to remove some "things" from collection if they aren't found in another collection. When I run the