C
C#14mo ago
Ruttie

❔ ThreadStatic for tasks

I need something that acts like ThreadStatic, but for async/await code. In my case, I need to set a context value. For example, in ASP.NET I want to set the HttpContext to have a value I want to access later, but only from this task and its children. How might I do this?
2 Replies
MarkPflug
MarkPflug14mo ago
AsyncLocal Class (System.Threading)
Represents ambient data that is local to a given asynchronous control flow, such as an asynchronous method.
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server