示例#1
0
        public static LTTask <T> FromException <T>(Exception ex)
        {
            var tcs = new LTTaskCompletionSource <T>();

            tcs.TrySetException(ex);
            return(tcs.Task);
        }
示例#2
0
        public static LTTask <T> FromCanceled <T>(CancellationToken token)
        {
            var tcs = new LTTaskCompletionSource <T>();

            tcs.TrySetException(new OperationCanceledException(token));
            return(tcs.Task);
        }
示例#3
0
        public static LTTask FromException(Exception ex)
        {
            LTTaskCompletionSource tcs = new LTTaskCompletionSource();

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