<PackageReference Include="Microsoft.Win32.SystemEvents" Version="10.0.0-preview.2.25163.2" />

SessionEndingEventHandler

public sealed delegate SessionEndingEventHandler : MulticastDelegate
Represents the method that will handle the SessionEnding event from the operating system.
public SessionEndingEventHandler(object object, IntPtr method)

public virtual IAsyncResult BeginInvoke(object sender, SessionEndingEventArgs e, AsyncCallback callback, object object)

public virtual void EndInvoke(IAsyncResult result)

public virtual void Invoke(object sender, SessionEndingEventArgs e)