Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/17/10 02:38:32 (14 years ago)
Author:
swagner
Message:

Implemented reviewers' comments (#863)

  • adapted item names of generic items to reflect the type of their generic parameters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs

    r3728 r3822  
    5050    public static string GetName(Type type) {
    5151      object[] attribs = type.GetCustomAttributes(typeof(ItemAttribute), false);
    52       if (attribs.Length > 0) return ((ItemAttribute)attribs[0]).Name;
    53       else return type.GetPrettyName();
     52      if (attribs.Length > 0) {
     53        string name = ((ItemAttribute)attribs[0]).Name;
     54        if (type.IsGenericType) {
     55          name += "<";
     56          Type[] typeParams = type.GetGenericArguments();
     57          if (typeParams.Length > 0) {
     58            name += GetName(typeParams[0]);
     59            for (int i = 1; i < typeParams.Length; i++)
     60              name += ", " + GetName(typeParams[i]);
     61          }
     62          name += ">";
     63        }
     64        return name;
     65      } else {
     66        return type.GetPrettyName();
     67      }
    5468    }
    5569    public static string GetDescription(Type type) {
Note: See TracChangeset for help on using the changeset viewer.