public abstract class BaseAspectAttribute : Attribute
{
protected internal virtual void OnMethodBeforeExecuting(object args)
{
Console.WriteLine("Base Attribute OnMethodBeforeExecuting Work");
}
}
public class LogAttribute : BaseAspectAttribute
{
protected override void OnMethodBeforeExecuting(object args)
{
Console.WriteLine("Log Attribute OnMethodBeforeExecuting Work");
}
}
我尝试在 LogAttribute => 中获取方法
object[] customAttributesOnMethod = methodInfo.GetCustomAttributes(typeof (BaseAspectAttribute), true);
foreach (object attribute in customAttributesOnMethod)
{
MethodInfo[] methodsInSelectedAttribute = attribute.GetType().GetMethods();
}
如何在 LogAttribute 中获取受保护的覆盖方法?