Which reed said, but I like this syntax a little better:
What happens is that you create a delegate function that will be passed as a parameter to the user interface thread through Control.Invoke , which calls it, so the user interface thread makes changes to importFileGridView .
importFileGridView.Invoke((MethodInvoker) delegate { importFileGridView.DataSource = temp.Tables[0]; });
You can also write this as follows:
and I would suggest using MethodInvoker over Action here: here
source share