Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/08 02:08:02 (16 years ago)
Author:
swagner
Message:

Worked on ticket #41

  • added generic ItemList<T>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/PersistenceManager.cs

    r22 r40  
    8282      return PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
    8383    }
     84
     85    public static string BuildTypeString(Type type) {
     86      string assembly = type.Assembly.FullName;
     87      assembly = assembly.Split(new string[] { ", " }, StringSplitOptions.None)[0];
     88
     89      StringBuilder builder = new StringBuilder();
     90      builder.Append(type.Namespace);
     91      builder.Append(".");
     92      builder.Append(type.Name);
     93      Type[] args = type.GetGenericArguments();
     94      if (args.Length > 0) {
     95        builder.Append("[[");
     96        builder.Append(BuildTypeString(args[0]));
     97        builder.Append("]");
     98        for (int i = 1; i < args.Length; i++) {
     99          builder.Append(",[");
     100          builder.Append(BuildTypeString(args[i]));
     101          builder.Append("]");
     102        }
     103        builder.Append("]");
     104      }
     105      builder.Append(", ");
     106      builder.Append(assembly);
     107      return builder.ToString();
     108    }
    84109  }
    85110}
Note: See TracChangeset for help on using the changeset viewer.