The core of Asynchrony: IAsyncResult
Asynchronous Programming Model
The whole asynchronous call process is around IAsyncResult, you can look at the example of the previous article, BeginXXX return this object, endxxx receive this object to end the current asynchronous object, let's look at the IAsyncResult interface member/ and AsyncResult class members that implement this interface (some of which are already covered in the previous article)
IAsyncResult interface
1public interface IAsyncResult
2 {
3 WaitHandle asyncwaithandle {get;}//Block a thread until one or more synchronization objects receive the signal
4 Bo Olean iscompleted {get;}//interpret whether the current asynchronous completes
5 Object asyncstate {getting;}///obtain additional parameter values, see the code 4.3
6 Boolean C for an article ompletedsynchronously {get;}///Almost no use of
7}
AsyncResult class
1 public class Asyncresult:iasyncresult, IMessageSink
2 {
3//iasyncresult implementation
4 public virtual W Aithandle asyncwaithandle {get;}
5 public virtual bool iscompleted {get;}
6 Public virtual object asyncstate {get;}
7 public virtual bool completedsynchronously {get;}
8
9//Other important attributes ten public
bool endinvokecalled {get; set;}//Check whether to invoke EndInvoke () one public
virtual Object AsyncDelegate {get;}//Gets the original delegate object to view the code 4.1/4.2/5 12} in the previous article
Note: Basically read-only properties