public override void Subscribe(IFlowableSubscriber <R> subscriber) { var s = sources; var a = new IPublisher <T> [8]; int n = 0; try { foreach (var p in sources) { if (p == null) { throw new NullReferenceException("One of the source IPublishers is null"); } if (n == a.Length) { var b = new IPublisher <T> [n + (n >> 2)]; Array.Copy(a, 0, b, 0, n); a = b; } a[n++] = p; } } catch (Exception ex) { subscriber.OnSubscribe(EmptySubscription <T> .Instance); subscriber.OnError(ex); return; } if (n == 0) { subscriber.OnSubscribe(EmptySubscription <T> .Instance); subscriber.OnComplete(); return; } if (n == 1) { Flowable.FromPublisher(a[0]).Map(v => combiner(new T[] { v })).Subscribe(subscriber); return; } var parent = new FlowableCombineLatest <T, R> .CombineLatestSubscription(subscriber, combiner, n, prefetch); subscriber.OnSubscribe(parent); parent.Subscribe(a); }