public static IPromise All(List <IPromise> promises) { Promise promise = new Promise(); promise.Resolve(); IPromise p2 = promise; foreach (IPromise p in promises) { p2 = p2.Pipe(() => { return(p); }); } return(p2); }