The exception is because the collection is modified when it's being enumerated. This answer explains well.
The difference is you are enumerating a DataTableCollection
, which is not a generic collection so the solution in the linked answer is not suitable in this case. You can cast the collection to a generic one and then enumerate it.
foreach (DataTable thisTable in this.Tables.Cast<DataTable>().ToArray())