Format() private method

private Format ( Type enumType, Object value, String format ) : String
enumType Type
value Object
format String
return String
        /// <summary>
        /// 枚举类型转换List<SelectListItem>
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <SelectListItem> EnumConvertToSelectListItem(this Type type)
        {
            List <SelectListItem> list = new List <SelectListItem>();

            if (type.IsEnum)
            {
                string[] names = Enum.GetNames(type);
                foreach (string name in names)
                {
                    list.Add(new SelectListItem {
                        Text = name, Value = Enum.Format(type, Enum.Parse(type, name), "d"), Selected = false
                    });
                }
            }
            return(list);
        }
 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, Enum value, Enum defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }