| | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Text; |
| | | |
| | | namespace CoreCms.Net.Utility.Extensions |
| | |
| | | return thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out result) ? result : result; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取枚举的标注的值 |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="value"></param> |
| | | /// <returns></returns> |
| | | public static string GetDescription(this Enum value) |
| | | { |
| | | var field = value.GetType().GetField(value.ToString()); |
| | | var attributes = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false); |
| | | return attributes.Length > 0 ? attributes[0].Description : value.ToString(); |
| | | } |
| | | |
| | | } |
| | | } |