System.Net.Dns.HostResolutionBeginHelper C# (CSharp) Method

HostResolutionBeginHelper() private static method

private static HostResolutionBeginHelper ( IPAddress address, bool flowContext, bool includeIPv6, AsyncCallback requestCallback, object state ) : IAsyncResult
address IPAddress
flowContext bool
includeIPv6 bool
requestCallback AsyncCallback
state object
return IAsyncResult
        private static IAsyncResult HostResolutionBeginHelper(IPAddress address, bool flowContext, bool includeIPv6, AsyncCallback requestCallback, object state)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }

            if (address.Equals(IPAddress.Any) || address.Equals(IPAddress.IPv6Any))
            {
                throw new ArgumentException(SR.net_invalid_ip_addr, nameof(address));
            }

            if (NetEventSource.IsEnabled) NetEventSource.Info(null, address);

            // Set up the context, possibly flow.
            ResolveAsyncResult asyncResult = new ResolveAsyncResult(address, null, includeIPv6, state, requestCallback);
            if (flowContext)
            {
                asyncResult.StartPostingAsyncOp(false);
            }

            // Start the resolve.
            Task.Factory.StartNew(
                s => ResolveCallback(s),
                asyncResult,
                CancellationToken.None,
                TaskCreationOptions.DenyChildAttach,
                TaskScheduler.Default);

            // Finish the flowing, maybe it completed?  This does nothing if we didn't initiate the flowing above.
            asyncResult.FinishPostingAsyncOp();
            return asyncResult;
        }

Same methods

Dns::HostResolutionBeginHelper ( string hostName, bool justReturnParsedIp, bool includeIPv6, bool throwOnIIPAny, AsyncCallback requestCallback, object state ) : IAsyncResult