AppDomain.DomainUnload 事件

定义

在即将卸载 AppDomain 时发生。

C#
public event EventHandler? DomainUnload;
C#
public event EventHandler DomainUnload;

事件类型

EventHandler

实现

注解

EventHandler 事件的委托可以在卸载应用程序域之前执行任何终止活动。

卸载应用程序时需要执行处理的每个应用程序域都应为此事件注册事件处理程序。 不应使用共享事件处理程序,因为 EventHandler 委托不标识正在卸载的域。

备注

此事件永远不会在默认应用程序域中引发。

不要对引发事件的线程做出假设。 可以在与调用 Unload 该方法的线程不同的线程上引发该事件。

有关处理事件的详细信息,请参阅 处理和引发事件

适用于

产品 版本
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 2.0, 2.1