Exemplo n.º 1
0
        internal static IAsyncOperationWithProgress<TResult, TProgress> CreateFaultedOperation<TResult, TProgress>(Exception error)
        {
            if (error == null)
                throw new ArgumentNullException("error");
            Contract.EndContractBlock();

            var asyncInfo = new TaskToAsyncOperationWithProgressAdapter<TResult, TProgress>(default(TResult));

            asyncInfo.DangerousSetError(error);
            Debug.Assert(asyncInfo.Status == AsyncStatus.Error);

            return asyncInfo;
        }
Exemplo n.º 2
0
        internal static IAsyncOperationWithProgress <TResult, TProgress> CreateFaultedOperation <TResult, TProgress>(Exception error)
        {
            if (error == null)
            {
                throw new ArgumentNullException(nameof(error));
            }

            var asyncInfo = new TaskToAsyncOperationWithProgressAdapter <TResult, TProgress>(default(TResult));

            asyncInfo.DangerousSetError(error);
            Debug.Assert(asyncInfo.Status == AsyncStatus.Error);

            return(asyncInfo);
        }
Exemplo n.º 3
0
        internal static IAsyncOperationWithProgress <TResult, TProgress> CreateCompletedOperation <TResult, TProgress>(TResult synchronousResult)
        {
            var asyncInfo = new TaskToAsyncOperationWithProgressAdapter <TResult, TProgress>(synchronousResult);

            return(asyncInfo);
        }