My coworker likes to do this
if (!listbox1.InvokeRequired)
listbox1.Items.Add(Container.error_message);
else
listbox1.Invoke((MethodInvoker)delegate
{
listbox1.Items.Add(Container.error_message);
});
Why do he have to check for InvokedRequired? Will it be better to just use this statement only?
listbox1.Invoke((MethodInvoker)delegate
{
listbox1.Items.Add(Container.error_message);
});