From 74a538f6725ebc83efda4bb07d5747e8a6359e19 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Mon, 16 Dec 2013 22:30:03 +0900 Subject: Import Official Rx 2.2 (3ebdd2e09991) I made changes from the original source tree to match the older tree so that we don't have to make several changes to project tree generator. (There is actually no new sources in Rx so hopefully we can just reuse existing modifications in the tree). --- .../Reactive/Linq/Observable/GroupBy.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/GroupBy.cs') diff --git a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/GroupBy.cs b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/GroupBy.cs index 1e64100..4f91030 100644 --- a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/GroupBy.cs +++ b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/GroupBy.cs @@ -7,20 +7,22 @@ using System.Linq; using System.Reactive.Disposables; using System.Reactive.Subjects; -namespace System.Reactive.Linq.ObservĪ±ble +namespace System.Reactive.Linq.ObservableImpl { class GroupBy : Producer> { private readonly IObservable _source; private readonly Func _keySelector; private readonly Func _elementSelector; + private readonly int? _capacity; private readonly IEqualityComparer _comparer; - public GroupBy(IObservable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) + public GroupBy(IObservable source, Func keySelector, Func elementSelector, int? capacity, IEqualityComparer comparer) { _source = source; _keySelector = keySelector; _elementSelector = elementSelector; + _capacity = capacity; _comparer = comparer; } @@ -49,7 +51,15 @@ namespace System.Reactive.Linq.ObservĪ±ble : base(observer, cancel) { _parent = parent; - _map = new Dictionary>(_parent._comparer); + + if (_parent._capacity.HasValue) + { + _map = new Dictionary>(_parent._capacity.Value, _parent._comparer); + } + else + { + _map = new Dictionary>(_parent._comparer); + } } public void OnNext(TSource value) -- cgit v1.2.3