Opc.Ua.WcfChannelBase.WcfChannelAsyncResult.WaitForComplete C# (CSharp) Method

WaitForComplete() public static method

Checks for a valid IAsyncResult object and waits for the operation to complete.
public static WaitForComplete ( IAsyncResult ar ) : WcfChannelAsyncResult
ar IAsyncResult The IAsyncResult object for the operation.
return WcfChannelAsyncResult
            public static new WcfChannelAsyncResult WaitForComplete(IAsyncResult ar)
            {
                WcfChannelAsyncResult asyncResult = ar as WcfChannelAsyncResult;

                if (asyncResult == null)
                {
                    throw new ArgumentException("End called with an invalid IAsyncResult object.", "ar");
                }

                if (!asyncResult.WaitForComplete())
                {
                    throw new ServiceResultException(StatusCodes.BadTimeout);
                }

                return asyncResult;
            }