保持这些记正在使用foreach而不是HttpContext.Current内的静态方法线程安全吗?
- Foreach
我有麻烦缠绕我的头围绕这...这是代码 “线程安全” 的ASP.NET?
public static bool IsCookieMissing()
{
foreach (string cookieKey in HttpContext.Current.Request.Cookies.AllKeys)
{
if (cookieKey.EndsWith("cookie_name"))
{
return false;
}
}
return true;
}
关于开始自己的线程的好处。我的代码确实实现了该模式以在ASP.NET中执行各种实用程序任务。 – felickz