C# - Automatically close a windows form after 1 minutes

C# - Automatically close a windows form after 1 minutes

This functionality to automatically close the app after 1 minutes in windows form.

private System.Windows.Forms.Timer tmr;
        public Form1()
        {
            
            InitializeComponent();

            tmr = new System.Windows.Forms.Timer();
            tmr.Tick += delegate
            {
                this.Close();
            };
            tmr.Interval = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
            tmr.Start();
        }

 

2020-04-27