4
Answers

Caching data for lifetime of thread

Photo of Dan Coupar

Dan Coupar

12y
5.1k
1
Hi folks,

I'm looking for a way of caching data for the lifetime of a thread. The data doesn't need to be accessible across threads. In ASP.NET, you can do this using the HttpContext.Current.Items collection. Anything you store in here is retained as long as the thread is alive, and is accessible from any class. I was wondering if there's a more generic equivalent in the .NET framework (4.0) which isn't tied to HTTP.

Thanks,
Dan.

Answers (4)