Can someone explain the syntax in this block of code?
Invoke((MethodInvoker)
(
() =>
{
checkedListBox1.Items.RemoveAt(i);
checkedListBox1.Items.Insert(i, temp);
checkedListBox1.Update();
}
)
);
I’m using a backgroundworker which needs to update parts of the UI so I used this. It works, but I don’t know what the empty () and => mean.
() and => is a lambda expression.
is a delegate of type
Action, which executes the code in the block.is a delegate of type
Func<string>, which executes the code in the block and then returns a string.is a delegate of type
Func<int, int, string>, which has two int parameters referred to i and j in the code block and returns a string.Etc…