Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions R3.DynamicData/Cache/SourceCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public IEnumerable<KeyValuePair<TObject, TKey>> KeyValues
/// Initializes a new instance of the <see cref="SourceCache{TObject, TKey}"/> class.
/// </summary>
/// <param name="keySelector">The function to extract the key from an object.</param>
public SourceCache(Func<TObject, TKey> keySelector)
/// <param name="initialCapacity">Optional initial capacity for the internal dictionary.</param>
public SourceCache(Func<TObject, TKey> keySelector, int initialCapacity = 0)
{
_keySelector = keySelector ?? throw new ArgumentNullException(nameof(keySelector));
_data = new Dictionary<TKey, TObject>();
_data = initialCapacity > 0 ? new Dictionary<TKey, TObject>(initialCapacity) : new Dictionary<TKey, TObject>();
_changes = new Subject<IChangeSet<TObject, TKey>>();
_countChanged = new Subject<int>();
}
Expand Down
Loading
Loading