Beispiel #1
0
        /// <summary>
        /// 将枚举类型转化为JSON字符串
        /// </summary>
        /// <returns></returns>
        public static string GetJson(Type type)
        {
            List <ReadEnum> list     = EnumHelper.GetEnumList(type);
            JsonProperty    property = new JsonProperty();

            foreach (ReadEnum item in list)
            {
                JsonObject jsonItem = new JsonObject();
                jsonItem.AddProperty("Name", item.Name);
                jsonItem.AddProperty("Value", item.Value);
                jsonItem.AddProperty("Description", item.Description);
                property.Add(jsonItem);
            }
            return(property.ToString());
        }