Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2540


Ignore:
Timestamp:
12/03/09 14:14:00 (14 years ago)
Author:
swagner
Message:

Fixed lookup to retrieve content types and added new method GetViewableTypes (#771)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.2/ContentAttribute.cs

    r2519 r2540  
    4444
    4545    public static bool HasContentAttribute(Type viewType) {
    46       ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), true);
     46      ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false);
    4747      return attributes.Length != 0;
    4848    }
     
    5353    }
    5454
     55    public static IEnumerable<Type> GetViewableTypes(Type viewType) {
     56      ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false);
     57      return from a in attributes
     58             select a.type;
     59    }
     60
    5561    public static bool IsDefaultViewForType(Type viewType, Type content) {
    5662      ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false);
     
    5965
    6066    public static IEnumerable<Type> GetDefaultViewableTypes(Type viewType) {
    61       ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), true);
     67      ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false);
    6268      return from a in attributes
    6369             where a.isDefaultView
Note: See TracChangeset for help on using the changeset viewer.