Changeset 1625 for trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/DictionaryDecomposer.cs
- Timestamp:
- 04/23/09 14:22:29 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/DictionaryDecomposer.cs
r1623 r1625 39 39 IDictionary dict = (IDictionary)instance; 40 40 IEnumerator<Tag> iter = o.GetEnumerator(); 41 while (iter.MoveNext()) { 42 Tag key = iter.Current; 43 iter.MoveNext(); 44 Tag value = iter.Current; 45 dict.Add(key.Value, value.Value); 46 } 41 try { 42 while (iter.MoveNext()) { 43 Tag key = iter.Current; 44 iter.MoveNext(); 45 Tag value = iter.Current; 46 dict.Add(key.Value, value.Value); 47 } 48 } catch (InvalidOperationException e) { 49 throw new PersistenceException("Dictionaries must contain an even number of elements (key+value).", e); 50 } catch (NotSupportedException e) { 51 throw new PersistenceException("The serialized dictionary type was read-only or had a fixed size and cannot be deserialized.", e); 52 } catch (ArgumentNullException e) { 53 throw new PersistenceException("Dictionary key was null.", e); 54 } catch (ArgumentException e) { 55 throw new PersistenceException("Duplicate dictionary key.", e); 56 } 47 57 } 48 58 }
Note: See TracChangeset
for help on using the changeset viewer.