/// <summary> /// Modifies a <paramref name="target"/> assembly to support intercepting calls to the 'new' operator. /// </summary> /// <param name="target">The assembly to be modified.</param> /// <param name="typeFilter">The functor that determines which type instantiations should be intercepted.</param> /// <remarks> /// The type filter determines the concrete types that should be intercepted at runtime. /// For example, the following functor code intercepts types named "Foo": /// <code> /// Func<TypeReference, bool> filter = /// concreteType => concreteType.Name == "Foo"; /// </code> /// </remarks> public static void InterceptNewInstances(this IReflectionVisitable target, Func <TypeReference, bool> typeFilter) { target.InterceptNewInstances(typeFilter, m => true); }
/// <summary> /// Modifies a <paramref name="target"/> to support intercepting all calls to the 'new' operator. /// </summary> /// <param name="target">The assembly to be modified.</param> public static void InterceptAllNewInstances(this IReflectionVisitable target) { Func <TypeReference, bool> typeFilter = GetTypeFilter(); target.InterceptNewInstances(typeFilter); }
/// <summary> /// Modifies a <paramref name="target"/> to support intercepting all calls to the 'new' operator. /// </summary> /// <param name="target">The assembly to be modified.</param> public static void InterceptAllNewInstances(this IReflectionVisitable target) { var typeFilter = GetTypeFilter(); target.InterceptNewInstances(typeFilter); }