Is this thread.abort() normal and safe?

后端 未结 5 1347
刺人心
刺人心 2020-11-27 21:30

I created a custom autocomplete control, when the user press a key it queries the database server (using Remoting) on another thread. When the user types very fast, the pro

5条回答
  •  渐次进展
    2020-11-27 22:01

    Use Thread.Abort only as a last-resort measure when you are exiting application and KNOW that all IMPORTANT resources are released safely.

    Otherwise, don't do it. It's even worse then

    try
    {
    //  do stuff
    }
    catch { } //  gulp the exception, don't do anything about it
    

    safety net...

提交回复
热议问题