Skip to content

Commit

Permalink
Changed constructors to take IEnumerable instead of the class
Browse files Browse the repository at this point in the history
  • Loading branch information
TwentyFourMinutes committed Jan 5, 2020
1 parent f3b195e commit 6a5a4c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/BidirectionalDict/BidirectionalDict/BiDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public BiDictionary()
_secondToFirst = new Dictionary<TSecond, TFirst>();
}

/// <summary>Initializes a new instance of the <see cref="BiDictionary{TFirst, TSecond}" /> class that contains elements copied from the specified <see cref= "Dictionary{TFirst, TSecond}" /> and uses the default equality comparer for the key type.</summary>
/// <param name="dictionary">The <see cref="Dictionary{TFirst, TSecond}" /> whose elements are copied to the new <see cref="BiDictionary{TFirst, TSecond}" />.</param>
public BiDictionary(Dictionary<TFirst, TSecond> dictionary)
/// <summary>Initializes a new instance of the <see cref="BiDictionary{TFirst, TSecond}" /> class that contains elements copied from the specified <see cref= "IEnumerable{KeyValuePair{TFirst, TSecond}}" /> and uses the default equality comparer for the key type.</summary>
/// <param name="dictionary">The <see cref="IEnumerable{KeyValuePair{TFirst, TSecond}}" /> whose elements are copied to the new <see cref="BiDictionary{TFirst, TSecond}" />.</param>
public BiDictionary(IEnumerable<KeyValuePair<TFirst, TSecond>> collection)
{
_firstToSecond = new Dictionary<TFirst, TSecond>(dictionary);
_secondToFirst = new Dictionary<TSecond, TFirst>(dictionary.ToDictionary(k => k.Value, v => v.Key));
_firstToSecond = new Dictionary<TFirst, TSecond>(collection);
_secondToFirst = new Dictionary<TSecond, TFirst>(collection.ToDictionary(k => k.Value, v => v.Key));
}

/// <summary>Initializes a new instance of the <see cref="BiDictionary{TFirst, TSecond}" /> class that is empty, has the default initial capacity, and uses the specified <see cref="IEqualityComparer{T}" />.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public ConcurrentBiDictionary()
_secondToFirst = new ConcurrentDictionary<TSecond, TFirst>();
}

/// <summary>Initializes a new instance of the <see cref="ConcurrentBiDictionary{TFirst, TSecond}" /> class that contains elements copied from the specified <see cref= "Dictionary{TFirst, TSecond}" /> and uses the default equality comparer for the key type.</summary>
/// <param name="dictionary">The <see cref="Dictionary{TFirst, TSecond}" /> whose elements are copied to the new <see cref="ConcurrentBiDictionary{TFirst, TSecond}" />.</param>
public ConcurrentBiDictionary(Dictionary<TFirst, TSecond> dictionary)
/// <summary>Initializes a new instance of the <see cref="ConcurrentBiDictionary{TFirst, TSecond}" /> class that contains elements copied from the specified <see cref= "IEnumerable{KeyValuePair{TFirst, TSecond}}" /> and uses the default equality comparer for the key type.</summary>
/// <param name="dictionary">The <see cref="IEnumerable{KeyValuePair{TFirst, TSecond}}" /> whose elements are copied to the new <see cref="ConcurrentBiDictionary{TFirst, TSecond}" />.</param>
public ConcurrentBiDictionary(IEnumerable<KeyValuePair<TFirst, TSecond>> collection)
{
_firstToSecond = new ConcurrentDictionary<TFirst, TSecond>(dictionary);
_secondToFirst = new ConcurrentDictionary<TSecond, TFirst>(dictionary.ToDictionary(k => k.Value, v => v.Key));
_firstToSecond = new ConcurrentDictionary<TFirst, TSecond>(collection);
_secondToFirst = new ConcurrentDictionary<TSecond, TFirst>(collection.ToDictionary(k => k.Value, v => v.Key));
}

/// <summary>Initializes a new instance of the <see cref="ConcurrentBiDictionary{TFirst, TSecond}" /> class that is empty, has the default initial capacity, and uses the specified <see cref="IEqualityComparer{T}" />.</summary>
Expand Down
10 changes: 5 additions & 5 deletions src/BidirectionalDict/BidirectionalDict/ReadOnlyBiDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public class ReadOnlyBiDictionary<TFirst, TSecond> : IReadOnlyBiDictionary<TFirs
private readonly IReadOnlyDictionary<TFirst, TSecond> _firstToSecond;
private readonly IReadOnlyDictionary<TSecond, TFirst> _secondToFirst;

/// <summary>Initializes a new instance of the <see cref="ReadOnlyBiDictionary{TFirst, TSecond}" /> class that contains elements copied from the specified <see cref="Dictionary{TFirst, TSecond}" /> and uses the default equality comparer for the key type.</summary>
/// <param name="dictionary">The <see cref="Dictionary{TFirst, TSecond}" /> whose elements are copied to the new <see cref="ReadOnlyBiDictionary{TFirst, TSecond}" />.</param>
public ReadOnlyBiDictionary(Dictionary<TFirst, TSecond> dictionary)
/// <summary>Initializes a new instance of the <see cref="ReadOnlyBiDictionary{TFirst, TSecond}" /> class that contains elements copied from the specified <see cref= "IEnumerable{KeyValuePair{TFirst, TSecond}}" /> and uses the default equality comparer for the key type.</summary>
/// <param name="dictionary">The <see cref="IEnumerable{KeyValuePair{TFirst, TSecond}}" /> whose elements are copied to the new <see cref="ReadOnlyBiDictionary{TFirst, TSecond}" />.</param>
public ReadOnlyBiDictionary(IEnumerable<KeyValuePair<TFirst, TSecond>> collection)
{
_firstToSecond = new ReadOnlyDictionary<TFirst, TSecond>(dictionary);
_secondToFirst = new ReadOnlyDictionary<TSecond, TFirst>(dictionary.ToDictionary(k => k.Value, v => v.Key));
_firstToSecond = new ReadOnlyDictionary<TFirst, TSecond>(collection.ToDictionary(k => k.Key, v => v.Value));
_secondToFirst = new ReadOnlyDictionary<TSecond, TFirst>(collection.ToDictionary(k => k.Value, v => v.Key));
}

/// <inheritdoc/>
Expand Down

0 comments on commit 6a5a4c5

Please sign in to comment.