Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10512 for trunk


Ignore:
Timestamp:
02/25/14 16:16:07 (11 years ago)
Author:
jkarder
Message:

#2136:

  • the Variables class now implements IEnumerable<T>
  • added Keys and Values properties to the Variables class
File:
1 edited

Legend:

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

    r10511 r10512  
    2121
    2222using System;
     23using System.Collections;
     24using System.Collections.Generic;
    2325using System.Dynamic;
    2426using System.IO;
     
    5254    }
    5355
    54     protected class Variables : DynamicObject {
     56    protected class Variables : DynamicObject, IEnumerable<KeyValuePair<string, object>> {
    5557      private readonly VariableStore variableStore;
     58
     59      public ICollection<string> Keys {
     60        get { return variableStore.Keys; }
     61      }
     62
     63      public ICollection<object> Values {
     64        get { return variableStore.Values; }
     65      }
    5666
    5767      public Variables(VariableStore variableStore) {
     
    7080      public bool Contains(string variableName) {
    7181        return variableStore.ContainsKey(variableName);
     82      }
     83
     84      public IEnumerator<KeyValuePair<string, object>> GetEnumerator() {
     85        return variableStore.GetEnumerator();
     86      }
     87
     88      IEnumerator IEnumerable.GetEnumerator() {
     89        return GetEnumerator();
    7290      }
    7391    }
Note: See TracChangeset for help on using the changeset viewer.