- Timestamp:
- 01/28/10 16:15:21 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm/3.2/ContentAttribute.cs
r2540 r2696 19 19 */ 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; … … 50 51 public static bool CanViewType(Type viewType, Type content) { 51 52 ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false); 52 return attributes.Any(a => a.type.IsAssignableFrom(content));53 return attributes.Any(a => content.IsAssignableTo(a.type)); 53 54 } 54 55 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 61 public static bool IsDefaultViewForType(Type viewType, Type content) { 62 ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false); 63 return attributes.Any(a => a.isDefaultView && a.type == content); 64 } 65 66 public static IEnumerable<Type> GetDefaultViewableTypes(Type viewType) { 56 internal static IEnumerable<Type> GetDefaultViewableTypes(Type viewType) { 67 57 ContentAttribute[] attributes = (ContentAttribute[])viewType.GetCustomAttributes(typeof(ContentAttribute), false); 68 58 return from a in attributes
Note: See TracChangeset
for help on using the changeset viewer.