private static Attribute[] GetAttributes(PropertyInfo propertyInfo, IEnumerable <Attribute> defaultCustomAttributes) { var propertyAttributes = propertyInfo.GetCustomAttributes(true).OfType <Attribute>(); var attributes = MyPropertyDescriptorForFields.GetAttributes(propertyInfo.PropertyType, propertyAttributes.Concat(defaultCustomAttributes)); //var attributes = new List<Attribute>(); //attributes.AddRange(defaultCustomAttributes); //var customAttributes = propertyInfo.GetCustomAttributes(true); //attributes.AddRange(customAttributes.OfType<Attribute>()); ////var attributes = customAttributes.OfType<Attribute>().ToList(); //if (!NonExpandedTypes.Contains(propertyInfo.PropertyType) && // !propertyInfo.PropertyType.IsEnum) //{ // bool implementsIEnumerable = typeof(System.Collections.IEnumerable).IsAssignableFrom(propertyInfo.PropertyType); // if (!implementsIEnumerable) // { // attributes.Add(new TypeConverterAttribute(typeof(MyTypeConverter))); // } // attributes.AddRange(propertyInfo.GetCustomAttributes(true).OfType<Attribute>()); //} return(attributes); }
static Attribute[] GetAttributes(IList <T> array, int index) { return(MyPropertyDescriptorForFields.GetAttributes(typeof(T), new Attribute[0])); }