Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/01/14 14:18:59 (10 years ago)
Author:
jkarder
Message:

#2203: fixed CloneByPersistence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting/3.3/VariableStore.cs

    r11058 r11066  
    4545            dict[kvp.Key] = CloneByPersistence(kvp.Value);
    4646          } 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);
    4848          }
    4949        }
     
    5959    }
    6060
    61     protected object CloneByPersistence(object value) {
     61    protected T CloneByPersistence<T>(T value) {
    6262      using (var serializerStream = new MemoryStream()) {
    6363        XmlGenerator.Serialize(value, serializerStream);
    6464        var bytes = serializerStream.GetBuffer();
    6565        using (var deserializerStream = new MemoryStream(bytes)) {
    66           return XmlParser.Deserialize<VariableStore>(deserializerStream);
     66          return XmlParser.Deserialize<T>(deserializerStream);
    6767        }
    6868      }
Note: See TracChangeset for help on using the changeset viewer.