<PackageReference Include="Castle.Core" Version="4.0.0-beta002" />

AllMethodsHook

using System; using System.Collections.Generic; using System.Reflection; namespace Castle.DynamicProxy { public class AllMethodsHook : IProxyGenerationHook { protected static readonly ICollection<Type> SkippedTypes = new Type[1] { typeof(object) }; public virtual bool ShouldInterceptMethod(Type type, MethodInfo methodInfo) { return !SkippedTypes.Contains(methodInfo.DeclaringType); } public virtual void NonProxyableMemberNotification(Type type, MemberInfo memberInfo) { } public virtual void MethodsInspected() { } public override bool Equals(object obj) { if (obj != null) return (object)obj.GetType() == GetType(); return false; } public override int GetHashCode() { return GetType().GetHashCode(); } } }