コード例 #1
0
        public static IEnumerable <PropertyAttributeHolder <T> > GetPropertiesWithAttributes <T>(Type type)
            where T : Attribute
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            var properties = TypesCache.PropertiesFor(type);

            // TODO cache
            return(from propertyInfo in properties
                   let attr = propertyInfo.GetCustomAttribute <T>()
                              where attr != null
                              select new PropertyAttributeHolder <T>(propertyInfo, attr));
        }