[ThreadStatic()]
的含义是什么?我有一段代码,我发现[ThreadStatic()]
在那里使用它是什么意思....何时使用[ThreadStatic()]
public class Context
{
[ThreadStatic()]
private static Context _Context = null;
private HttpContext _HttpContext = null;
public Context()
{
_HttpContext = HttpContext.Current;
}
public static Context Current
{
if(_Context == null ||
_HttpContext != _HttpContext.Current)
{
_Context = new Context();
}
return _Context;
}
}
答案 0 :(得分:2)
答案 1 :(得分:2)