The Invoke method expects an instance of type Delegate, because you are using a lambda expression, it cannot automatically convert the expression to something like the new Delegate (), because the delegate does not have public constructors. Using
this.Invoke(new Action(() => {this.UpdateUserList();}));
Should solve the problem, since Action is a subclass of Delegate. To get rid of the redundant new Action (...) when using Invoke, you can write a set of extension methods that take Action as an argument, so the new Action (...) will be handled by the C # compiler so you don't have to write every time making your code cleaner.
If you use Invoke for some asynchronous operations, which may include other threads, look at the parallel task library (TPL) and the task-based asynchronous template (TAP), the latter has built-in support in C # and Visual Basic.NET, using await will no longer require invoke () and allows you to perform some operations in the background, freeing up your user interface.
source share