Changeset 11066
- Timestamp:
- 07/01/14 14:18:59 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Scripting/3.3/VariableStore.cs
r11058 r11066 45 45 dict[kvp.Key] = CloneByPersistence(kvp.Value); 46 46 } catch (PersistenceException pe) { 47 throw new NotSupportedException( "VariableStore: Variable " + kvp.Key + " could not be cloned.", pe);47 throw new NotSupportedException(string.Format(@"VariableStore: Variable ""{0}"" could not be cloned.", kvp.Key), pe); 48 48 } 49 49 } … … 59 59 } 60 60 61 protected object CloneByPersistence(objectvalue) {61 protected T CloneByPersistence<T>(T value) { 62 62 using (var serializerStream = new MemoryStream()) { 63 63 XmlGenerator.Serialize(value, serializerStream); 64 64 var bytes = serializerStream.GetBuffer(); 65 65 using (var deserializerStream = new MemoryStream(bytes)) { 66 return XmlParser.Deserialize< VariableStore>(deserializerStream);66 return XmlParser.Deserialize<T>(deserializerStream); 67 67 } 68 68 }
Note: See TracChangeset
for help on using the changeset viewer.