示例#1
0
        public static ETTask <T> FromCanceled <T>(CancellationToken token)
        {
            var tcs = new ETTaskCompletionSource <T>();

            tcs.TrySetException(new OperationCanceledException(token));
            return(tcs.Task);
        }
示例#2
0
        public static ETTask FromException(Exception ex)
        {
            ETTaskCompletionSource tcs = new ETTaskCompletionSource();

            tcs.TrySetException(ex);
            return(tcs.Task);
        }
示例#3
0
        public static ETTask <T> FromException <T>(Exception ex)
        {
            var tcs = new ETTaskCompletionSource <T>();

            tcs.TrySetException(ex);
            return(tcs.Task);
        }