protected void FindAnnotations <V>(Type type, IList <IAnnotationInfo <V> > targetList, bool isFirst) where V : Attribute { if (type == null || typeof(Object).Equals(type)) { return; } if (!type.IsInterface) { FindAnnotations <V>(type.BaseType, targetList, false); } IList <V> annotations = AnnotationUtil.GetAnnotations <V>(type, false); for (int a = 0, size = annotations.Count; a < size; a++) { targetList.Add(new AnnotationInfo <V>(annotations[a], type)); } //if (isFirst) //{ // Type[] interfaces = type.GetInterfaces(); // foreach (Type currInterface in interfaces) // { // IList<V> annotationsOfInterface = AnnotationUtil.GetAnnotations<V>(currInterface, true); // for (int a = 0, size = annotationsOfInterface.Count; a < size; a++) // { // targetList.Add(new AnnotationInfo<V>(annotationsOfInterface[a], type)); // } // } //} }
protected IList <IAnnotationInfo <V> > FindAnnotations <V>(Type type, MethodInfo method) where V : Attribute { IList <IAnnotationInfo <V> > targetList = new List <IAnnotationInfo <V> >(); FindAnnotations <V>(type, targetList, true); if (method != null) { IList <V> annotations = AnnotationUtil.GetAnnotations <V>(method, true); for (int a = 0, size = annotations.Count; a < size; a++) { targetList.Add(new AnnotationInfo <V>(annotations[a], method)); } } return(targetList); }