score:3

Accepted answer

How about:

var query = from property in _target.GetType().GetProperties()
            let attributes = Attribute.GetCustomAttributes(property, true)
            where attributes.Any()
            let val = _propertyValueAccessor.GetValue(_target, property)  
            from attribute in attributes
            select new PropertyContext
            {
                PropertyValue = val,
                Annotation = attribute,
                SourceType = _target,
            };

Related Articles