Changeset 9009 for trunk/sources/HeuristicLab.Collections
- Timestamp:
- 12/06/12 15:52:29 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Collections/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Collections/3.3/BidirectionalDictionary.cs
r9000 r9009 21 21 22 22 using System; 23 using System.Linq; 24 using System.Collections; 23 25 using System.Collections.Generic; 24 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 26 28 namespace HeuristicLab.Collections { 27 29 [StorableClass] 28 public class BidirectionalDictionary<TFirst, TSecond> { 30 [Serializable] 31 public class BidirectionalDictionary<TFirst, TSecond> : IEnumerable<KeyValuePair<TFirst, TSecond>> { 29 32 [Storable] 30 33 private readonly Dictionary<TFirst, TSecond> firstToSecond; … … 53 56 secondToFirst = new Dictionary<TSecond, TFirst>(secondComparer); 54 57 } 58 public BidirectionalDictionary(BidirectionalDictionary<TFirst, TSecond> other) 59 : base() { 60 firstToSecond = new Dictionary<TFirst, TSecond>(other.firstToSecond, other.firstToSecond.Comparer); 61 secondToFirst = new Dictionary<TSecond, TFirst>(other.secondToFirst, other.secondToFirst.Comparer); 62 } 55 63 56 64 #region Properties … … 65 73 public IEnumerable<TSecond> SecondValues { 66 74 get { return secondToFirst.Keys; } 67 }68 69 public IEnumerable<KeyValuePair<TFirst, TSecond>> FirstEnumerable {70 get { return firstToSecond; }71 }72 73 public IEnumerable<KeyValuePair<TSecond, TFirst>> SecondEnumerable {74 get { return secondToFirst; }75 75 } 76 76 #endregion … … 139 139 secondToFirst.Clear(); 140 140 } 141 142 public IEnumerator<KeyValuePair<TFirst, TSecond>> GetEnumerator() { 143 return firstToSecond.GetEnumerator(); 144 } 145 146 IEnumerator IEnumerable.GetEnumerator() { 147 return GetEnumerator(); 148 } 141 149 #endregion 142 150 } -
trunk/sources/HeuristicLab.Collections/3.3/BidirectionalLookup.cs
r9000 r9009 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 26 27 namespace HeuristicLab.Collections { 27 28 [StorableClass] 29 [Serializable] 28 30 public class BidirectionalLookup<TFirst, TSecond> { 29 31 [Storable]
Note: See TracChangeset
for help on using the changeset viewer.