Created
September 26, 2017 15:45
-
-
Save codevalve/1ddf005b87eb0676a5e95e1d88bae79c to your computer and use it in GitHub Desktop.
C# Removing a row during foreach iteration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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