Esempio n. 1
0
        /// <summary>
        /// Returns an array of custom attributes identified by RuntimeType.
        /// </summary>
        /// <param name="attributeType">Type of attribute to search for. Only attributes that are assignable to this type are returned.</param>
        /// <returns>An array of custom attributes applied to this member, or an array with zero (0) elements if no matching attributes have been applied.</returns>
        public object[] GetCustomAttributes(RuntimeType attributeType)
        {
            List<object> result = new List<object>();
            if (this.attributes != null)
            {
                foreach (RuntimeAttribute attribute in this.attributes)
                {
                    if (attributeType.IsAssignableFrom(attribute.Type))
                        result.Add(attribute.GetAttribute());
                }
            }

            return result.ToArray();
        }