试图了解this MSDN sample但我困惑的这些行:为什么要打电话给WaitOne如果你只是打电话结束后?不结束吗?
IAsyncResult result = Dns.BeginGetHostEntry(args[0], null, null);
Console.WriteLine("Processing request for information...");
// Wait until the operation completes.
result.AsyncWaitHandle.WaitOne();
// The operation completed. Process the results.
try
{
// Get the results.
IPHostEntry host = Dns.EndGetHostEntry(result);
例如,为什么还要使用异步编程,如果你只是去,直到任务完成反正阻塞线程?另外,拨打WaitOne
还有什么好处呢? End操作不会自动阻塞,直到操作完成?
在这里很困惑..
这不是它的样子:http://msdn.microsoft.com/en-us/library/ms143989%28v=VS.100%29.aspx –
Hans:你是什么意思? –