private IEnumerable <PropertyDescriptor> ResolvePropertiesDescriptor() { var _properties = new List <PropertyDescriptor>(); var _propertiesInfos = _profileType.GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (var _propertyInfo in _propertiesInfos) { if (Attribute.IsDefined(_propertyInfo, typeof(ResolveResourceBaseAttribute), false)) { var _propertySetter = _propertyInfo.GetSetMethod(true); if (!_propertyInfo.CanWrite) { throw new ResolveResourceException( string.Format(RESOLVEPROP_MUSTBE_WRITABLE, _propertyInfo.Name, DescriptorType), DescriptorType); } if (!_propertySetter.IsPublic) { throw new ResolveResourceException( string.Format(RESOLVEPROP_MUSTBE_PUBLIC, _propertyInfo.Name, DescriptorType), DescriptorType); } if (_propertySetter.IsStatic) { throw new ResolveResourceException( string.Format(RESOLVEPROP_MUSTBE_INSTANCE, _propertyInfo.Name, DescriptorType), DescriptorType); } if (_propertyInfo.GetIndexParameters().Length > 0) { throw new ResolveResourceException( string.Format(RESOLVEPROP_MUSTNOTBE_PARAMETERIZED, _propertyInfo.Name, DescriptorType), DescriptorType); } var _attribute = Attribute.GetCustomAttribute(_propertyInfo, typeof(ResolveResourceBaseAttribute)); _properties.Add(new PropertyDescriptor() { Property = _propertyInfo, Resolver = (IResourceResolver)_attribute , PropertySetterDelegate = TypeActivator.CreatePropertyDelegate(_propertyInfo) }); } } return(_properties); }