A faster implementation of AcceptChanges? So I started wondering why it takes 3.5 seconds to AcceptChanges for one changed record in a large DataTable. I wrote another implementation of AcceptChanges (VB.NET) - Me is a DataTable here:

Public Shadows Sub AcceptChanges()
  'this way AcceptChanges is 35 to 700 faster than Microsoft's way
  '35 is a speed factor when all rows were changed, and 700 is when a few
  'Tested on sets of 13K and 65K records
  Dim updatedRows() As DataRow = Me.Select(Nothing, Nothing, _
    DataViewRowState.Added Or DataViewRowState.Deleted Or _
    DataViewRowState.ModifiedCurrent Or DataViewRowState.ModifiedOriginal)
  For Each row As DataRow In updatedRows
    row.AcceptChanges()
  Next
End Sub


It appears to be from 35 to 700 times faster than Microsoft's implementation. Did I just uncover/solve a great mystery of ADO.NET, or am I missing something here?
It's quite easy to answer your question by looking at the DataTable.AcceptChanges source code.

As you can see they copy all DataRow objects into new array before iterating them. I suspect that your code will work incorrectly when rows are deleted (accepting changes for deleted rows means removing them from DataTable), most likely you'll get exception since it's not allowed to change collection while iterating it.