This is not "this.Invoke". This is either
System.Windows.Forms.Control.Invoke
or
System.Windows.Threading.Dispatcher
:
http://msdn.microsoft.com/en-us/library/zyzhdc6b(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/a1hetckb(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher%28v=vs.110%29.aspx[
^].
While
System.Windows.Forms.Control.Invoke
is used only for
System.Windows.Forms
,
System.Windows.Threading.Dispatcher
can be used for both Forms and WPF.
And no, ASP.NET does not have analog of it, by one simple reason: an ASP application itself is not analogous to a Forms or a WPF application, its life cycle is totally different. ASP.NET application is not really an even-oriented UI, but a page in the client side is. That said, all the events are really handled on client side via JavaScipt (even though the ASP.NET technology creates some illusion that code behind and in-browser UI is tightly integrated, through postbacks, but in reality, it's very important to understand that this is only an illusion, or, if you will, a metaphor). Everything is reduced to the fact that HTTP is a
stateless protocol majorly supporting
client-server model:
http://en.wikipedia.org/wiki/HTTP#HTTP_session_state[
^],
http://en.wikipedia.org/wiki/Stateless_protocol[
^],
http://en.wikipedia.org/wiki/Client-server_model[
^].
From the code-behind perspective, all the lifetime of the page lies between HTTP request and HTTP response; all that the ASP.NET code does is creation of the HTTP response which is then delivered to the client side and all the UI is unfolded on the client side. The callback allows to involve code behind in event handling, but a developer should understand that it seriously compromises performance (at least these days) and should happen not too often.
All that makes desktop UI-style threading and invocation quite irrelevant. Not that threading in ASP.NET is impossible. It is possible, but majorly useless. You will understand it if you analyze the above considerations. However,
Tasks
and
Parallel
can still be effectively used for certain things (on a multi-CPU/multi-code system), but this is a whole different story not really related to UI.
—SA