using System; using System.Collections.Generic; using System.Reflection; namespace HMI.Util { class PropertyHelper { public static List GetAtterProperty(out List attrs) where A : Attribute { var result = new List(); attrs = new List(); var type = typeof(T); var attrType = typeof(A); PropertyInfo[] properties = type.GetProperties(); foreach (var prop in properties) { if (Attribute.IsDefined(prop, attrType)) { result.Add(prop); attrs.Add((A)Attribute.GetCustomAttribute(prop, attrType)); } } return result; } } }