Ejemplo n.º 1
0
        /// <summary>
        /// Returns a dictionary with the data (property name and value) of the supplied attribute.
        /// </summary>
        public static Dictionary <string, object> ExtractAttributeProperties(this Attribute SourceAttribute)
        {
            Dictionary <string, object> PropertiesValues = new Dictionary <string, object>();

            if (SourceAttribute != null)
            {
                foreach (PropertyInfo PropertyData in SourceAttribute.GetType().GetProperties())
                {
                    PropertiesValues.Add(PropertyData.Name, PropertyData.GetValue(SourceAttribute, null));
                }
            }

            return(PropertiesValues);
        }