Example #1
0
        /// <summary>
        /// Get all enums in the specified category.
        /// </summary>
        /// <param name="category">Category to filter by.</param>
        /// <returns>Collection with categories.</returns>
        public static string[] ContentTypeGroup(EnumGroupCategory category)
        {
            Type          t      = typeof(ContentType);
            List <string> fields = new List <string>();

            foreach (FieldInfo field in t.GetFields())
            {
                if (category == EnumGroupCategory.None || (field.GetCustomAttributes(true).Length > 0 && ((EnumGroupAttribute)field.GetCustomAttributes(true)[0]).Category.ToString().Equals(category.ToString())))
                {
                    if (!field.Name.Equals("value__") &&
                        (field.GetCustomAttributes(true).Length > 0 && ((EnumGroupAttribute)field.GetCustomAttributes(true)[0]).Category != EnumGroupCategory.None))
                    {
                        fields.Add(field.Name);
                    }
                }
            }

            return(fields.ToArray());
        }
 /// <summary>
 /// Get all enums in the specified category.
 /// </summary>
 /// <param name="category">Category to filter by.</param>
 /// <returns>Collection with categories.</returns>
 public string[] ContentTypeGroups(EnumGroupCategory category)
 {
     return(Utils.ContentTypeGroup(category));
 }