private void AddPreDestroyMethodPoints(TypeDescription description, MethodInfo[] methods) { List <OrderedInjectionPoint> orderedInjectionPoints = new List <OrderedInjectionPoint> (); foreach (MethodInfo method in methods) { object[] injections = method.GetCustomAttributes(PRE_DESTROY_ATTRIBUTE_TYPE, true); if (injections.Length == 0) { continue; } PreDestroy attr = injections [0] as PreDestroy; PreDestroyInjectionPoint injectionPoint = new PreDestroyInjectionPoint(attr.order, method); orderedInjectionPoints.Add(injectionPoint); } orderedInjectionPoints.Sort(SortInjectionPoints); foreach (PreDestroyInjectionPoint point in orderedInjectionPoints) { description.AddPreDestroyMethod(point); } }