コード例 #1
0
        /// <summary>
        /// Begins an asynchronous call of <paramref name="method"/> on given <paramref name="proxy"/>.
        /// </summary>
        /// <typeparam name="TProxy">The type of the proxy.</typeparam>
        /// <param name="proxy">The proxy.</param>
        /// <param name="method">The delegate encapsulating the invocation of the method.</param>
        /// <param name="callback">The asynchronous callback.</param>
        /// <param name="state">The asynchronous state.</param>
        /// <returns>The async call handle.</returns>
        public static IWcfAsyncCall BeginWcfCall <TProxy>(this TProxy proxy, Action <TProxy> method,
                                                          AsyncCallback callback, object state)
        {
            var call = new AsyncWcfCall <TProxy>(proxy, method);

            call.Begin(ar => callback(call), state);
            return(call);
        }
コード例 #2
0
        /// <summary>
        /// Begins an asynchronous call of <paramref name="method"/> on given <paramref name="proxy"/>.
        /// </summary>
        /// <typeparam name="TProxy">The type of the proxy.</typeparam>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="proxy">The proxy.</param>
        /// <param name="method">The delegate encapsulating the invocation of the method.</param>
        /// <param name="callback">The asynchronous callback.</param>
        /// <param name="state">The asynchronous state.</param>
        /// <returns>The async call handle.</returns>
        public static IWcfAsyncCall <TResult> BeginWcfCall <TProxy, TResult>(
            this TProxy proxy, Func <TProxy, TResult> method,
            AsyncCallback callback, object state)
        {
            var call = new AsyncWcfCall <TProxy, TResult>(proxy, method);

            call.Begin(ar => callback(call), state);
            return(call);
        }