我有一个在新线程中调用的方法“ImportExcel”:
[STAThread]
private void btnImportExcel_Click(object sender, EventArgs e)
{
// Start by setting up a new thread using the delegate ThreadStart
// We tell it the entry function (the function to call first in the thread)
// Think of it as main() for the new thread.
ThreadStart theprogress = new ThreadStart(ImportExcel);
// Now the thread which we create using the delegate
Thread startprogress = new Thread(theprogress);
startprogress.SetApartmentState(ApartmentState.STA);
// We can give it a name (optional)
startprogress.Name = "Book Detail Scrapper";
// Start the execution
startprogress.Start();
}
现在在 ImportExcel() 函数中,有一个 try catch 块。在 catch 块中,如果发生特定异常,我希望再次调用 ImportExcel() 函数。我怎么做?