/// <summary> /// 是否包含某特性 /// </summary> /// <typeparam name="T">特性类型</typeparam> /// <param name="filterContext">AOP对象</param> /// <returns></returns> public static bool ContainsAttribute <T>(this ActionExecutingContext filterContext) where T : Attribute { return(filterContext.GetAllCustomAttributes().Any(x => x.GetType() == typeof(T))); }