Changeset 4068 for trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/KeyValuePairSerializer.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/KeyValuePairSerializer.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 using System. Collections.Generic;25 using System.Reflection; 25 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 using HeuristicLab.Persistence.Interfaces; 27 using System.Reflection;28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { … … 42 42 public bool CanSerialize(Type type) { 43 43 return type.IsGenericType && 44 type.GetGenericTypeDefinition() == genericKeyValuePairType; 44 type.GetGenericTypeDefinition() == genericKeyValuePairType; 45 45 } 46 46 47 47 public string JustifyRejection(Type type) { 48 48 if (!type.IsGenericType) 49 return "not even generic"; 49 return "not even generic"; 50 50 return "not generic KeyValuePair<,>"; 51 51 } … … 60 60 try { 61 61 key = new Tag("key", t.GetProperty("Key").GetValue(o, null)); 62 } catch (Exception e) { 62 } 63 catch (Exception e) { 63 64 throw new PersistenceException("Exception caught during KeyValuePair decomposition", e); 64 65 } … … 66 67 try { 67 68 value = new Tag("value", t.GetProperty("Value").GetValue(o, null)); 68 } catch (Exception e) { 69 } 70 catch (Exception e) { 69 71 throw new PersistenceException("Exception caught during KeyValuePair decomposition", e); 70 72 } … … 85 87 t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) 86 88 .Single(fi => fi.Name == "value").SetValue(instance, iter.Current.Value); 87 } catch (InvalidOperationException e) { 89 } 90 catch (InvalidOperationException e) { 88 91 throw new PersistenceException("Not enough components to populate KeyValuePair instance", e); 89 } catch (Exception e) { 92 } 93 catch (Exception e) { 90 94 throw new PersistenceException("Exception caught during KeyValuePair reconstruction", e); 91 95 }
Note: See TracChangeset
for help on using the changeset viewer.