Thread provides an API to save data to a thread, just as every thread in ASP. NET saves a session.
Use thread. getdata and setdata to read or write data. ExampleCodeAs follows:
Thread. setdata (thread. getnameddataslot ("key"), data );
Object Data = thread. getdata (thread. getnameddataslot ("key "));
Thread. getnameddataslot ("key") is used to obtain a named data slot. If this method is called for the first time, this name slot will be created first.
With the above method, each thread can read and write data in the data slot without causing conflicts. That is to say, the content read by two different threads is the content they write themselves. The second link in the following link mentions that the namedata slot can be released. In actual use, there is no need to release or cause memory leakage.
Related Links
Http://msdn.microsoft.com/zh-cn/library/6sby1byh%28v=VS.90%29.aspx
Http://hi.baidu.com/lhdisme/blog/item/69772bf841061c0ad9f9fde0.html