Hello,
There is no equivalent of the Shutdown mode in C#. However, if you want to implement the feature "Shutdown when last form closes", we can do it in this way in C#
In C# main method,
Code Snippet
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
List<Form> forms = new List<Form>();
Form1 form1 = new Form1();
forms.Add(form1);
form1.Show();
Form2 form2 = new Form2();
forms.Add(form2);
form2.Show();
Application.Run();
the list<form> forms is used to record all the open forms of the application. Everytime we create a new form, we should add the form into the list.
For each form, we register its OnClosing event. In the event handler, we remove the form itself from the forms list, and check if the forms is empty, if it is empty, we can assert that all the forms have been closed, so we call Application.Exit to shut down the application at the moment.
Hope it helps.
Regards
Jialiang Ge