Changeset 12452


Ignore:
Timestamp:
06/16/15 12:11:48 (4 years ago)
Author:
mkommend
Message:

#2276: Adapted generic GetValues<T> method in Dataset to avoid ToList calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r12141 r12452  
    166166      return GetValues<DateTime>(variableName);
    167167    }
     168
    168169    public ReadOnlyCollection<double> GetReadOnlyDoubleValues(string variableName) {
    169       var values = GetValues<double>(variableName).ToList();
     170      var values = GetValues<double>(variableName);
    170171      return values.AsReadOnly();
    171172    }
    172173    public double GetDoubleValue(string variableName, int row) {
    173       var values = GetValues<double>(variableName) as List<double>;
     174      var values = GetValues<double>(variableName);
    174175      return values[row];
    175176    }
     
    178179    }
    179180    private IEnumerable<T> GetValues<T>(string variableName, IEnumerable<int> rows) {
    180       var values = GetValues<T>(variableName) as List<T>;
     181      var values = GetValues<T>(variableName);
    181182      return rows.Select(x => values[x]);
    182183    }
    183     private IEnumerable<T> GetValues<T>(string variableName) {
     184    private List<T> GetValues<T>(string variableName) {
    184185      IList list;
    185186      if (!variableValues.TryGetValue(variableName, out list))
Note: See TracChangeset for help on using the changeset viewer.