Skip to content

Instantly share code, notes, and snippets.

@codevalve
Created September 26, 2017 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codevalve/1ddf005b87eb0676a5e95e1d88bae79c to your computer and use it in GitHub Desktop.
Save codevalve/1ddf005b87eb0676a5e95e1d88bae79c to your computer and use it in GitHub Desktop.
C# Removing a row during foreach iteration
// Based on example from https://stackoverflow.com/users/13338/jeff
YourDataTable.AcceptChanges();
foreach ( DataRow row in YourDataTable.Rows )
{
// If this row offends thee, then
row.Delete();
}
YourDataTable.AcceptChanges();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment