From 6a5a4c5dd6b65d69ddedc85d007a09f6440ed187 Mon Sep 17 00:00:00 2001 From: Twenty Date: Sun, 5 Jan 2020 17:38:34 +0100 Subject: [PATCH] Changed constructors to take IEnumerable instead of the class --- .../BidirectionalDict/BiDictionary.cs | 10 +++++----- .../BidirectionalDict/ConcurrentBiDictionary.cs | 10 +++++----- .../BidirectionalDict/ReadOnlyBiDictionary.cs | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/BidirectionalDict/BidirectionalDict/BiDictionary.cs b/src/BidirectionalDict/BidirectionalDict/BiDictionary.cs index 24dced4..52111d9 100644 --- a/src/BidirectionalDict/BidirectionalDict/BiDictionary.cs +++ b/src/BidirectionalDict/BidirectionalDict/BiDictionary.cs @@ -29,12 +29,12 @@ public BiDictionary() _secondToFirst = new Dictionary(); } - /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. - /// The whose elements are copied to the new . - public BiDictionary(Dictionary dictionary) + /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. + /// The whose elements are copied to the new . + public BiDictionary(IEnumerable> collection) { - _firstToSecond = new Dictionary(dictionary); - _secondToFirst = new Dictionary(dictionary.ToDictionary(k => k.Value, v => v.Key)); + _firstToSecond = new Dictionary(collection); + _secondToFirst = new Dictionary(collection.ToDictionary(k => k.Value, v => v.Key)); } /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . diff --git a/src/BidirectionalDict/BidirectionalDict/ConcurrentBiDictionary.cs b/src/BidirectionalDict/BidirectionalDict/ConcurrentBiDictionary.cs index 7943660..365e061 100644 --- a/src/BidirectionalDict/BidirectionalDict/ConcurrentBiDictionary.cs +++ b/src/BidirectionalDict/BidirectionalDict/ConcurrentBiDictionary.cs @@ -30,12 +30,12 @@ public ConcurrentBiDictionary() _secondToFirst = new ConcurrentDictionary(); } - /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. - /// The whose elements are copied to the new . - public ConcurrentBiDictionary(Dictionary dictionary) + /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. + /// The whose elements are copied to the new . + public ConcurrentBiDictionary(IEnumerable> collection) { - _firstToSecond = new ConcurrentDictionary(dictionary); - _secondToFirst = new ConcurrentDictionary(dictionary.ToDictionary(k => k.Value, v => v.Key)); + _firstToSecond = new ConcurrentDictionary(collection); + _secondToFirst = new ConcurrentDictionary(collection.ToDictionary(k => k.Value, v => v.Key)); } /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . diff --git a/src/BidirectionalDict/BidirectionalDict/ReadOnlyBiDictionary.cs b/src/BidirectionalDict/BidirectionalDict/ReadOnlyBiDictionary.cs index 9275091..ec1d881 100644 --- a/src/BidirectionalDict/BidirectionalDict/ReadOnlyBiDictionary.cs +++ b/src/BidirectionalDict/BidirectionalDict/ReadOnlyBiDictionary.cs @@ -23,12 +23,12 @@ public class ReadOnlyBiDictionary : IReadOnlyBiDictionary _firstToSecond; private readonly IReadOnlyDictionary _secondToFirst; - /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. - /// The whose elements are copied to the new . - public ReadOnlyBiDictionary(Dictionary dictionary) + /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. + /// The whose elements are copied to the new . + public ReadOnlyBiDictionary(IEnumerable> collection) { - _firstToSecond = new ReadOnlyDictionary(dictionary); - _secondToFirst = new ReadOnlyDictionary(dictionary.ToDictionary(k => k.Value, v => v.Key)); + _firstToSecond = new ReadOnlyDictionary(collection.ToDictionary(k => k.Key, v => v.Value)); + _secondToFirst = new ReadOnlyDictionary(collection.ToDictionary(k => k.Value, v => v.Key)); } ///