Examples of asynchronous communication in C # .Net?
I know that it is possible to implicitly provide asynchronous communication using:
- Asynchronous delegates
- Asynchronous callbacks
I'm just wondering what other methods .NET supports for asynchronous communication?
Help with gratitude.
Hello
EDIT:
Maybe I didn't explain myself correctly .... I UNDERSTAND THREAD AND CONCURRENCY USING that I just need a list of possible ways to implement asynchronous communication in .NET besides using asynchronous delegates or callbacks.
a source to share
(I'm not sure I fully understand what you are aiming for in your question, but I'll give it a chance)
For enabling asynchronous code execution in winforms applications, the BackgroundWorker component is quite handy. I also use the ThreadPool.QueueUserWorkItem method a lot as an easy way to spawn a method on my thread.
a source to share
Take a look at this web page, it is beautifully written with good examples: http://www.yoda.arachsys.com/csharp/threads/
a source to share
Asynchronous operation in .NET run by calling the name BeginSomething
, which Something
is likely to be Invoke
, Write
, Send
or another operation.
Example:
http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.beginsend.aspx
You are passing a custom delegate that will be executed after the operation completes. Then you can get the result of the operation by calling the appropriate method EndSomething
.
Example:
http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.endsend(VS.80).aspx
The pattern is usually the same regardless of the operation performed. There are oddities when a method EndSomething
is called something inconsistent.
Other examples:
a source to share
you could use Expression tress or other monads (don't allow me to link it yet, but the term can be found on the wiki and Calvin has a great blog on this topic)
basically anything that allows you to create uneven coding can be used for asynchronous implementations.
You can also google to continue transfer. A coding style where all methods do not return a value (void) but take a parameter (kind delegate) passing it what to do when done.
a source to share