Skip to content

Instantly share code, notes, and snippets.

@revirth
Created October 20, 2014 09:04
Show Gist options
  • Save revirth/6df3a4f1351d6ee07b56 to your computer and use it in GitHub Desktop.
Save revirth/6df3a4f1351d6ee07b56 to your computer and use it in GitHub Desktop.
Parallel.ForEach(strings, str=>
{
DataRow row;
lock(table){
row= table.NewRow();
}
MyParser.Parse(str, out row);
lock(table){
table.Rows.Add(row)
}
});
// http://stackoverflow.com/questions/21310757/thread-safety-for-datatable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment