/// <summary>Ends an asynchronous request for DNS information.</summary> /// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance that contains address information about the host.</returns> /// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> instance returned by a call to an <see cref="Overload:System.Net.Dns.BeginGetHostEntry" /> method.</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="asyncResult" /> is null. </exception> public static IPHostEntry EndGetHostEntry(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException("asyncResult"); } AsyncResult asyncResult2 = (AsyncResult)asyncResult; if (asyncResult2.AsyncDelegate is Dns.GetHostEntryIPCallback) { return(((Dns.GetHostEntryIPCallback)asyncResult2.AsyncDelegate).EndInvoke(asyncResult)); } Dns.GetHostEntryNameCallback getHostEntryNameCallback = (Dns.GetHostEntryNameCallback)asyncResult2.AsyncDelegate; return(getHostEntryNameCallback.EndInvoke(asyncResult)); }