Beispiel #1
0
        public static string GetDescription <T>(this T value)
        {
            Type                 typeInfo  = typeof(T);
            FieldInfo            field     = typeInfo.GetField(value.ToString());
            DescriptionAttribute attribute = (DescriptionAttribute)DescriptionAttribute.GetCustomAttribute(field, typeof(DescriptionAttribute));

            return(attribute.Description);
        }
Beispiel #2
0
        public static string GetDescription(this GameKind value)
        {
            Type                 enumType      = typeof(GameKind);
            FieldInfo            enumFieldInfo = enumType.GetField(value.ToString());
            DescriptionAttribute attribute     = (DescriptionAttribute)DescriptionAttribute.GetCustomAttribute(enumFieldInfo, typeof(DescriptionAttribute));

            return(attribute.Description);
        }
        public static string GetDescription <T>(this T status)
        {
            Type                 enumType      = typeof(T);
            FieldInfo            enumFieldInfo = enumType.GetField(status.ToString());
            DescriptionAttribute attribute     = (DescriptionAttribute)
                                                 DescriptionAttribute.GetCustomAttribute(enumFieldInfo, typeof(DescriptionAttribute));

            return(attribute.Description);
        }
Beispiel #4
0
        /// <summary>构造函数</summary>
        /// <param name="table"></param>
        /// <param name="property"></param>
        public FieldItem(TableItem table, PropertyInfo property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            _Table = table;

            _Property        = property;
            _Column          = BindColumnAttribute.GetCustomAttribute(_Property);
            _DataObjectField = DataObjectAttribute.GetCustomAttribute(_Property, typeof(DataObjectFieldAttribute)) as DataObjectFieldAttribute;
            _Description     = DescriptionAttribute.GetCustomAttribute(_Property, typeof(DescriptionAttribute)) as DescriptionAttribute;
        }