Пример #1
0
        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
        {
            List <object> vs = new List <object>();

            if (attributeType != null)
            {
                IList <ConstObjectPointer> lst = _property.GetCustomAttributeList();
                if (lst != null && lst.Count > 0)
                {
                    foreach (ConstObjectPointer o in lst)
                    {
                        if (attributeType == null || attributeType.IsAssignableFrom(o.BaseClassType))
                        {
                            vs.Add(o.Value);
                        }
                    }
                }
                if (inherit)
                {
                    object[] vsh = _property.PropertyType.BaseClassType.GetCustomAttributes(inherit);
                    if (vsh != null)
                    {
                        for (int i = 0; i < vsh.Length; i++)
                        {
                            if (vsh[i] != null)
                            {
                                if (attributeType == null || attributeType.IsAssignableFrom(vsh[i].GetType()))
                                {
                                    vs.Add(vsh[i]);
                                }
                            }
                        }
                    }
                }
            }
            return(vs.ToArray());
        }