Mercurial > pub > ImplabNet
comparison Implab/PromiseT.cs @ 146:e03ccec4a08d v2
minor changes
author | cin |
---|---|
date | Mon, 09 Mar 2015 17:21:20 +0300 |
parents | 8c0b95069066 |
children | 4d9830a9bbb8 |
comparison
equal
deleted
inserted
replaced
145:706fccb85524 | 146:e03ccec4a08d |
---|---|
39 /// </para> | 39 /// </para> |
40 /// </remarks> | 40 /// </remarks> |
41 public class Promise<T> : AbstractPromise<T>, IDeferred<T> { | 41 public class Promise<T> : AbstractPromise<T>, IDeferred<T> { |
42 | 42 |
43 public static IPromise<T> FromResult(T value) { | 43 public static IPromise<T> FromResult(T value) { |
44 var p = new Promise<T>(); | 44 return new SuccessPromise<T>(value); |
45 p.Resolve(value); | |
46 return p; | |
47 } | 45 } |
48 | 46 |
49 public static IPromise<T> FromException(Exception error) { | 47 public static IPromise<T> FromException(Exception error) { |
50 var p = new Promise<T>(); | 48 var p = new Promise<T>(); |
51 p.Reject(error); | 49 p.Reject(error); |