<PackageReference Include="Castle.Windsor" Version="5.1.0" />

OnDestroyConcern<TComponent>

public class OnDestroyConcern<TComponent> : IDecommissionConcern
using Castle.Core; namespace Castle.MicroKernel.LifecycleConcerns { public class OnDestroyConcern<TComponent> : IDecommissionConcern { private readonly LifecycleActionDelegate<TComponent> action; private readonly IKernel kernel; public OnDestroyConcern(LifecycleActionDelegate<TComponent> action, IKernel kernel) { this.action = action; this.kernel = kernel; } public void Apply(ComponentModel model, object component) { TComponent item = (TComponent)component; action(kernel, item); } } }