How to include own data in ExecutionContext

前端 未结 2 1079
刺人心
刺人心 2021-01-11 19:06

I know that when you run some method in parallel by calling BeginInvoke() or ThreadPool.QueueUserWorkItem(...) .NET framework is capturing ExecutionContext object that conta

相关标签:
2条回答
  • 2021-01-11 19:19

    I don't know how it relates to ExecutionContext, but back in the day, we could create context-bound objects. See Context class. Ignore the fact that this particular class is for infrastructure - the article is a starting point to learn about contexts.

    0 讨论(0)
  • 2021-01-11 19:31

    Found it:

    CallContext.LogicalSetData(...)
    

    (documentation)

    and

    CallContext.LogicalGetData(...)
    

    (documentation)

    0 讨论(0)
提交回复
热议问题