public DiagnosticEventCollection(IDiagnosticProcessor diagnosticProcessor)
 {
     foreach (var method in diagnosticProcessor.GetType().GetMethods())
     {
         var diagnosticName = method.GetCustomAttribute <DiagnosticNameAttribute>();
         if (diagnosticName == null)
         {
             continue;
         }
         _eventDict.Add(diagnosticName.Name, new DiagnosticEvent(diagnosticProcessor, method));
     }
 }
        private static Listener EnlistTarget(IDiagnosticProcessor target)
        {
            var listener = new Listener(target);

            //var methodInfos = target.GetType().GetMethods();//获取所有公开的方法(包括继承方法)

            var typeInfo    = target.GetType().GetTypeInfo();//获取所有方法(包括私有方法,不包括继承方法)
            var methodInfos = typeInfo.DeclaredMethods;

            foreach (var methodInfo in methodInfos)
            {
                var diagnosticNameAttribute = methodInfo.GetCustomAttribute <DiagnosticAdapterName>();
                if (diagnosticNameAttribute != null)
                {
                    try
                    {
                        listener.Subscriptions.Add(diagnosticNameAttribute.Name, new DiagnosticMethodSubscription(target, methodInfo, diagnosticNameAttribute.Name));
                    }
                    catch { }
                }
            }

            return(listener);
        }