Changeset 3822 for trunk/sources/HeuristicLab.Core/3.3/Attributes
- Timestamp:
- 05/17/10 02:38:32 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs
r3728 r3822 50 50 public static string GetName(Type type) { 51 51 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 } 54 68 } 55 69 public static string GetDescription(Type type) {
Note: See TracChangeset
for help on using the changeset viewer.