Winform no método de saída de saída

public Form1{
  //some code...
  AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

}
public void OnProcessExit(object sender,EventArgs e){
   MyDataLoggerMethod("Monitoring ended.");
}
Perfect Pollan