What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003.
The development and deployment of Microsoft.NET Remoting components forms part of your responsibilities at Domain.com. You have just completed the development of a Microsoft.NET Remoting component. You now need to call a remote method asynchronously and obtain an IAsyncResult instance as a result. You thus need to perform additional processing while the asynchronous operation is taking place.

What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003.
The development and deployment of Microsoft.NET Remoting components forms part of your responsibilities at Domain.com. You have just completed the development of a Microsoft.NET Remoting component. You now need to call a remote method asynchronously and obtain an IAsyncResult instance as a result. You thus need to perform additional processing while the asynchronous operation is taking place.

What should you do?

A.
You should create a loop and poll on the IAsyncResult.IsCompleted property.

B.
You should create a loop and poll on the IAsyncResult.CompleteSynchronously property.

C.
You should call the WaitAny method of the WaitHandle class, passing to it a WaitHandle array that contains the IAsyncResult.AsyncWaitHandle object.

D.
You should call the WaitAll method of the WaitHandle class, passing to it a WaitHandle array that contains the IAsyncResult.AsyncWaitHandle object.

Explanation:
A loop and poll on the IAsyncResult.IsCompleted property will indicate whether the asynchronous operation has completed. This will allow you to perform additional processing during the asynchronous operation.
Incorrect answers:
B: The .CompleteSynchronous property will determine whether an asynchronous operation was actually completed synchronously. If you poll this property, you will be creating an infinite loop for operations that do not complete synchronously.
C: You should not call the WaitAny method of the WaitHandle class because it will block the current thread until at least one asynchronous operation reaches completion. Blocking should not be implemented in this case because you need to perform additional processing while the asynchronous operation is taking place.
D: You should not call the WaitAll method of the WaitHandle class because it blocks the current thread until all asynchronous operations are completed.



Leave a Reply 0

Your email address will not be published. Required fields are marked *