Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2681


Ignore:
Timestamp:
01/25/10 13:01:09 (15 years ago)
Author:
epitzer
Message:

also allow sub namespaces that don't contain any types (#842)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Programmable/3.2/ProgrammableOperator.cs

    r2679 r2681  
    124124          foreach (var t in a.Key.GetTypes()) {
    125125            if (t.IsPublic) {
    126               namespaces.Add(t.Namespace);
     126              foreach (string ns in GetNamespaceHierachy(t.Namespace)) {
     127                namespaces.Add(ns);
     128              }
    127129            }
    128130          }
     
    131133      return namespaces;
    132134    }
     135
     136    private IEnumerable<string> GetNamespaceHierachy(string ns) {
     137      for (int i = ns.Length; i != -1; i = ns.LastIndexOf('.', i - 1)) {
     138        yield return ns.Substring(0, i);
     139      }
     140    }
     141
    133142    #endregion
    134143
    135144    #region Construction & Initialization
    136    
     145
    137146    public ProgrammableOperator() {
    138147      code = "";
Note: See TracChangeset for help on using the changeset viewer.