public static string GetCategory( Type type ) { foreach ( var categoryAttribute in type.GetCustomAttributes( typeof( CategoryAttribute ), true ) ) { return ( (CategoryAttribute)categoryAttribute ).Category; } return null; }